X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=store.h;h=a77febecbe6bb3514fc1a3b07e6a9ae8e835c858;hb=2466c23751f131a07432df964658c2de90315e7b;hp=be351b70ea70092709155aa9b1c2e750d95e7ceb;hpb=121a58d72f3b5e537007072f93397f6e6661fb90;p=odcread.git diff --git a/store.h b/store.h index be351b7..a77febe 100644 --- a/store.h +++ b/store.h @@ -3,10 +3,19 @@ #include #include +#include +#include #include +#include namespace odc { + class Reader; // forward decl + + class TypePath : public std::vector { + public: + std::string toString() const; + }; /** * TYPE Store @@ -17,9 +26,12 @@ namespace odc { */ class Store { private: + static const TopTypeProxy PROXY; + INTEGER d_id; public: + static const std::string TYPENAME; static const SHORTCHAR NEWBASE = 0xF0; // (* new base type (level = 0), i.e. not yet in dict *) static const SHORTCHAR NEWEXT = 0xF1; // (* new extension type (level = 1), i.e. not yet in dict *) static const SHORTCHAR OLDTYPE = 0xF2; // (* old type, i.e. already in dict *) @@ -33,6 +45,15 @@ namespace odc { INTEGER getId(); + /** + * Get the TypeName for this object. + */ + virtual const std::string &getTypeName() const; + /** + * Get the TypePath to this object's type. + * @see TypePath + */ + TypePath getTypePath() const; /** * PROCEDURE (s: Store) Domain (): Domain @@ -40,7 +61,7 @@ namespace odc { * A store may be associated with a domain. This is done by the procedure InitDomain, which assigns a domain to the store. * Domain may be called by arbitrary clients. */ - Domain* getDomain(); + //Domain* getDomain(); /** * PROCEDURE (s: Store) CopyFrom- (source: Store) @@ -66,7 +87,7 @@ namespace odc { * source.Domain() = NIL guaranteed * source is not yet initialized guaranteed */ -// void internalize(Reader &reader) { + virtual void internalize(Reader &reader); // PROCEDURE (s: Store) Internalize- (VAR rd: Reader), NEW, EXTENSIBLE; // VAR thisVersion: INTEGER; // BEGIN @@ -99,9 +120,52 @@ namespace odc { */ // FIXME - virtual std::string toString() = 0; + virtual std::string toString(); + + /** + * Receiving end of the Visitor pattern. + */ + virtual void accept(Visitor &visitor) const; + + private: + void calcTypePath(TypePath *out, const std::string &name) const; }; + class Elem : public Store { + private: + static const TypeProxy PROXY; + + public: + static const std::string TYPENAME; + virtual const std::string &getTypeName() const; + + Elem(INTEGER id); + virtual void internalize(Reader &reader); + }; + + class Model : public Elem { + private: + static const TypeProxy PROXY; + + public: + static const std::string TYPENAME; + virtual const std::string &getTypeName() const; + + Model(INTEGER id); + virtual void internalize(Reader &reader); + }; + + class ContainerModel : public Model { + private: + static const TypeProxy PROXY; + + public: + static const std::string TYPENAME; + virtual const std::string &getTypeName() const; + + ContainerModel(INTEGER id); + virtual void internalize(Reader &reader); + }; } #endif // _STORE_H_