UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RecDef.hpp
1 /* RecDef.hpp */
2 /* $Id: RecDef.hpp,v 1.9 2005/01/24 14:32:53 vlad Exp $ */
3 #ifndef __RecDef_hpp
4 #define __RecDef_hpp
5 
6 #include <mix/Types.h>
7 #include <mix/DmnSet.hpp>
8 #include <mix/Exceptions.h>
9 
10 
19 class RecDef : public SerialThis
20 {
21 public:
22 
25  RecDef (const char* rtname, const DomainAr& dmns);
26 
29  RecDef (const char* rtname, int dmns_n, const DomainDef* dmns);
30 
32  RecDef (const RecDef& rdef);
33 
36  RecDef (const char* rtname, const RecDef& rdef1, const RecDef& rdef2);
37 
39  RecDef (InputStream& ist);
40 
42  virtual ~RecDef ();
43 
44 
46  const char* record_name () const;
47 
49  size_t record_size () const;
50 
52  unsigned domain_count () const;
53 
55  int n2i (const char* dname) const;
56 
58  void* offset (int dmn_i, const void* base) const;
59 
61  const DomainDef& domain_def (int dmn_i) const;
62 
64  DomainDef* domain_defs () const;
65 
67  void set_options (int dmn_i, void* options);
68 
70  virtual void serialize (OutputStream& ost) const;
71 
73  virtual void deserialize (InputStream& ist);
74 
76  virtual void add_domain (const DomainDef& dmn);
77 
78 
82  bool operator== (const RecDef& rdef) const;
83 
87  bool operator!= (const RecDef& rdef) const {
88  return !operator==(rdef);
89  }
90 
92  bool check_domain (const char* dname) const;
93 
95  bool check_domain (const char* dname,
96  AtomType atype,
97  unsigned dim = 1) const;
98 
99 private:
100 
102  char *rec_name;
103 
105  DomainSet *domains;
106 
108  bool own_memory;
109 
111  size_t rec_size;
112 
113 protected:
114 
116  RecDef (RecDef* rdef);
117 
120  RecDef ();
121 
124  void constructor (const char* rtname, const DomainAr& dmns);
125 
126 };
127 
128 
129 #ifdef __RecDef_vars
130 
132 RecDef rEmptyRecDef("Empty", 0, NULL);
133 
134 #else /* __RecDef_vars */
135 
136 extern RecDef rEmptyRecDef;
137 
138 #endif /* __RecDef_vars */
139 
140 
141 #endif /* RecDef.hpp */
bool operator==(const RecDef &rdef) const
void set_options(int dmn_i, void *options)
virtual ~RecDef()
size_t record_size() const
bool operator!=(const RecDef &rdef) const
Definition: RecDef.hpp:87
virtual void serialize(OutputStream &ost) const
Definition: DmnSet.hpp:32
Definition: Serial.hpp:22
void constructor(const char *rtname, const DomainAr &dmns)
bool check_domain(const char *dname) const
unsigned domain_count() const
virtual void add_domain(const DomainDef &dmn)
Definition: DmnDef.h:25
Definition: Serial.hpp:69
virtual void deserialize(InputStream &ist)
const DomainDef & domain_def(int dmn_i) const
void * offset(int dmn_i, const void *base) const
int n2i(const char *dname) const
DomainDef * domain_defs() const
const char * record_name() const
Definition: RecDef.hpp:19
Definition: Serial.hpp:131