commore  1.0.6-SNAPSHOT
All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Tuple.h
1 //
2 // Copyright (c) 2006-2007 Raphael David / CANTOR
3 //
4 
5 #ifndef CMR_TUPLE_INCLUDED
6 #define CMR_TUPLE_INCLUDED
7 
8 #include "Commore.h"
9 #include "Symbol.h"
10 #include "AString.h"
11 #include "String.h"
12 #include "Time.h"
13 #include "Blob.h"
14 #include "StringBuffer.h"
15 #include "List.h"
16 #include "Array.h"
17 
18 
19 namespace commore
20 {
21  typedef Tuple* PTuple;
22 
29  class CMREXD Tuple
30  {
31  public:
32  class ValueIterator;
33  class ConstValueIterator;
37  class CMREXD Value
38  {
39  friend class Tuple;
40  friend class ValueIterator;
41  friend class ConstValueIterator;
42 
43  unsigned int att_type_;
44  Value* next_;
45  void* ref_;
46  void destroy();
47  void set_symbol(const Symbol& att);
48  void set_type(Types type);
49  void set_is_ref(bool ref);
50  void set_is_const(bool cnst);
51  Value* clone() const;
52  public:
56  Symbol get_symbol() const;
60  Types get_type() const;
64  bool get_is_ref() const;
68  bool get_is_const() const;
72  const Value* get_next() const;
76  Value* get_next();
81  const void* get_pvalue() const;
86  void* get_pvalue();
87 
91  const Bool* is_bool() const;
95  Bool* is_bool();
99  const ListBool* is_list_bool() const;
103  ListBool* is_list_bool();
104 
108  const Int* is_int() const;
112  Int* is_int();
116  const ListInt* is_list_int() const;
120  ListInt* is_list_int();
121 
125  const Long* is_long() const;
129  Long* is_long();
133  const ListLong* is_list_long() const;
137  ListLong* is_list_long();
138 
142  const Float* is_float() const;
146  Float* is_float();
150  const ListFloat* is_list_float() const;
154  ListFloat* is_list_float();
155 
159  const Double* is_double() const;
163  Double* is_double();
167  const ListDouble* is_list_double() const;
171  ListDouble* is_list_double();
172 
176  const Symbol* is_symbol() const;
180  Symbol* is_symbol();
184  const ListSymbol* is_list_symbol() const;
188  ListSymbol* is_list_symbol();
189 
193  const AString* is_astring() const;
197  AString* is_astring();
201  const ListAString* is_list_astring() const;
205  ListAString* is_list_astring();
206 
210  const String* is_string() const;
214  String* is_string();
218  const ListString* is_list_string() const;
222  ListString* is_list_string();
223 
227  const StringBuffer* is_stringbuffer() const;
231  StringBuffer* is_stringbuffer();
235  const ListStringBuffer* is_list_stringbuffer() const;
239  ListStringBuffer* is_list_stringbuffer();
240 
244  const Blob* is_blob() const;
248  Blob* is_blob();
252  const ListBlob* is_list_blob() const;
256  ListBlob* is_list_blob();
257 
261  const Tuple* is_tuple() const;
265  Tuple* is_tuple();
269  const ListTuple* is_list_tuple() const;
273  ListTuple* is_list_tuple();
274 
278  const TimeDate* is_time_date() const;
282  TimeDate* is_time_date();
286  const ListTimeDate* is_list_time_date() const;
290  ListTimeDate* is_list_time_date();
291 
295  const TimePeriod* is_time_period() const;
299  TimePeriod* is_time_period();
303  const ListTimePeriod* is_list_time_period() const;
307  ListTimePeriod* is_list_time_period();
308 
312  const ArrayInt* is_array_int() const;
316  ArrayInt* is_array_int();
320  const ListArrayInt* is_list_array_int() const;
324  ListArrayInt* is_list_array_int();
325 
329  const ArrayLong* is_array_long() const;
333  ArrayLong* is_array_long();
337  const ListArrayLong* is_list_array_long() const;
341  ListArrayLong* is_list_array_long();
342 
346  const ArrayFloat* is_array_float() const;
350  ArrayFloat* is_array_float();
354  const ListArrayFloat* is_list_array_float() const;
358  ListArrayFloat* is_list_array_float();
359 
363  const ArrayDouble* is_array_double() const;
367  ArrayDouble* is_array_double();
371  const ListArrayDouble* is_list_array_double() const;
375  ListArrayDouble* is_list_array_double();
376  };
377 
378  typedef Value* PValue;
379 
383  class CMREXD ValueIterator
384  {
385  public:
389  ValueIterator(Tuple& t);
393  operator bool() const { return more(); }
394 
395  public:
399  Symbol get_name() const;
403  bool more() const;
408  bool next();
409 
414  ValueIterator& operator++() { next(); return *this; }
419  ValueIterator operator++(int) { ValueIterator r = *this; next(); return r; }
423  Value* operator -> () const { return value_; }
427  Types get_type();
428  private:
429  PValue value_;
430  };
431 
432  friend class ValueIterator;
433 
437  class CMREXD ConstValueIterator
438  {
439  public:
443  ConstValueIterator(const Tuple& t);
447  operator bool() const { return more(); }
448 
449  public:
453  Symbol get_name() const;
457  bool more() const;
462  bool next();
467  ConstValueIterator& operator++() { next(); return *this; }
472  ConstValueIterator operator++(int) { ConstValueIterator r = *this; next(); return r; }
476  const Value* operator -> () const { return value_; }
480  Types get_type();
481  private:
482  const Value* value_;
483 
484  };
485 
486  friend class ConstValueIterator;
487 
488  public:
489  Tuple();
493  Tuple(const AChar* class_name);
497  Tuple(const Symbol& class_name);
498  Tuple(const Tuple& tuple);
499  Tuple& operator = (const Tuple& tuple) { return assign(tuple); }
503  operator bool () { return !is_empty(); }
504  ~Tuple();
505 
506  public:
510  Tuple& assign(const Tuple& tuple);
515  Tuple& merge(const Tuple& tuple);
521  Tuple& merge_only(const Tuple& tuple, const ListSymbol& atts);
528  Tuple& merge_except(const Tuple& tuple, const ListSymbol& atts);
534  Tuple& splice(Tuple& tuple);
538  Tuple& diff(const Tuple& t1, const Tuple& t2);
542  void clear();
546  bool is_a(Symbol class_name) const { return symbolClass_ == class_name; }
552  inline AString& set_astring(const Symbol& att, const AChar* v);
558  inline AString& add_astring(const Symbol& att, const AChar* v = 0);
559 
565  inline String& set_string(const Symbol& att, const Char* v);
571  inline String& add_string(const Symbol& att, const Char* v = 0);
572 
578  inline StringBuffer& set_stringbuffer(const Symbol& att, const AChar* v);
584  inline StringBuffer& add_stringbuffer(const Symbol& att, const AChar* v);
585 
586 
590  bool is_set(const Symbol& att) const;
594  bool is_set(const Symbol& att, Types type) const;
598  bool is_null(const Symbol& att) const;
602  void set_null(const Symbol& att);
606  void clear(const Symbol& att);
610  void clear(const ListSymbol& att);
611 
615  void keep(const ListSymbol& att);
619  void clear_list(const Symbol& att);
620 
624  bool is_empty() const;
625 
629  AString& to_string(AString& s) const;
633  AString& to_string(const AString& s = AString()) const;
637  long from_string(const AString& s);
638 
639 
643  const Symbol& get_class_name() const { return symbolClass_; }
647  void set_class_name(const Symbol& className);
648 
652  void get_attributes(ListAString& l) const;
653 
669  inline const Symbol& get_symbol(const Symbol& att) const;
670  inline const Symbol* get_psymbol(const Symbol& att) const;
671  inline Symbol& set_symbol(const Symbol& att);
672  inline Symbol& set_symbol(const Symbol& att, const Symbol& v);
673  inline Symbol& set_ref_symbol(const Symbol& att, Symbol& v);
674  inline const Symbol& set_cref_symbol(const Symbol& att, const Symbol& v);
675  inline const ListSymbol& get_list_symbol(const Symbol& att) const;
676  inline const ListSymbol* get_plist_symbol(const Symbol& att) const;
677  inline ListSymbol& set_list_symbol(const Symbol& att);
678  inline ListSymbol& set_list_symbol(const Symbol& att, const ListSymbol& v);
679  inline ListSymbol& set_ref_list_symbol(const Symbol& att, ListSymbol& v);
680  inline const ListSymbol& set_cref_list_symbol(const Symbol& att, const ListSymbol& v);
681  inline Symbol& add_symbol(const Symbol& att, const Symbol& v = Symbol());
682  inline Int get_int(const Symbol& att, Int pv = 0) const;
683  inline const Int* get_pint(const Symbol& att) const;
684  inline Int& set_int(const Symbol& att);
685  inline Int& set_int(const Symbol& att, Int v);
686  inline Int& set_ref_int(const Symbol& att, Int& v);
687  inline const Int& set_cref_int(const Symbol& att, const Int& v);
688  inline const ListInt& get_list_int(const Symbol& att) const;
689  inline const ListInt* get_plist_int(const Symbol& att) const;
690  inline ListInt& set_list_int(const Symbol& att);
691  inline ListInt& set_list_int(const Symbol& att, const ListInt& v);
692  inline ListInt& set_ref_list_int(const Symbol& att, ListInt& v);
693  inline const ListInt& set_cref_list_int(const Symbol& att, const ListInt& v);
694  inline void add_int(const Symbol& att, Int v);
695  inline Bool get_bool(const Symbol& att, Bool pv = 0) const;
696  inline const Bool* get_pbool(const Symbol& att) const;
697  inline Bool& set_bool(const Symbol& att);
698  inline Bool& set_bool(const Symbol& att, Bool v);
699  inline Bool& set_ref_bool(const Symbol& att, Bool& v);
700  inline const Bool& set_cref_bool(const Symbol& att, const Bool& v);
701  inline const ListBool& get_list_bool(const Symbol& att) const;
702  inline const ListBool* get_plist_bool(const Symbol& att) const;
703  inline ListBool& set_list_bool(const Symbol& att);
704  inline ListBool& set_list_bool(const Symbol& att, const ListBool& v);
705  inline ListBool& set_ref_list_bool(const Symbol& att, ListBool& v);
706  inline const ListBool& set_cref_list_bool(const Symbol& att, const ListBool& v);
707  inline void add_bool(const Symbol& att, Bool v);
708 
709  inline Long get_long(const Symbol& att, Long pv = 0) const;
710  inline const Long* get_plong(const Symbol& att) const;
711  inline Long& set_long(const Symbol& att);
712  inline Long& set_long(const Symbol& att, Long v);
713  inline Long& set_ref_long(const Symbol& att, Long& v);
714  inline const Long& set_cref_long(const Symbol& att, const Long& v);
715  inline const ListLong& get_list_long(const Symbol& att) const;
716  inline const ListLong* get_plist_long(const Symbol& att) const;
717  inline ListLong& set_list_long(const Symbol& att);
718  inline ListLong& set_list_long(const Symbol& att, const ListLong& v);
719  inline ListLong& set_ref_list_long(const Symbol& att, ListLong& v);
720  inline const ListLong& set_cref_list_long(const Symbol& att, const ListLong& v);
721  inline void add_long(const Symbol& att, Long v);
722 
723  inline Float get_float(const Symbol& att, Float pv = 0) const;
724  inline const Float* get_pfloat(const Symbol& att) const;
725  inline Float& set_float(const Symbol& att);
726  inline Float& set_float(const Symbol& att, Float v);
727  inline Float& set_ref_float(const Symbol& att, Float& v);
728  inline const Float& set_cref_float(const Symbol& att, const Float& v);
729  inline const ListFloat& get_list_float(const Symbol& att) const;
730  inline const ListFloat* get_plist_float(const Symbol& att) const;
731  inline ListFloat& set_list_float(const Symbol& att);
732  inline ListFloat& set_list_float(const Symbol& att, const ListFloat& v);
733  inline ListFloat& set_ref_list_float(const Symbol& att, ListFloat& v);
734  inline const ListFloat& set_cref_list_float(const Symbol& att, const ListFloat& v);
735  inline void add_float(const Symbol& att, Float v);
736 
737  inline Double get_double(const Symbol& att, Double pv = 0) const;
738  inline const Double* get_pdouble(const Symbol& att) const;
739  inline Double& set_double(const Symbol& att);
740  inline Double& set_double(const Symbol& att, Double v);
741  inline Double& set_ref_double(const Symbol& att, Double& v);
742  inline const Double& set_cref_double(const Symbol& att, const Double& v);
743  inline const ListDouble& get_list_double(const Symbol& att) const;
744  inline const ListDouble* get_plist_double(const Symbol& att) const;
745  inline ListDouble& set_list_double(const Symbol& att);
746  inline ListDouble& set_list_double(const Symbol& att, const ListDouble& v);
747  inline ListDouble& set_ref_list_double(const Symbol& att, ListDouble& v);
748  inline const ListDouble& set_cref_list_double(const Symbol& att, const ListDouble& v);
749  inline void add_double(const Symbol& att, Double v);
750 
751  inline TimeDate get_time_date(const Symbol& att, TimeDate pv = 0) const;
752  inline const TimeDate* get_ptime_date(const Symbol& att) const;
753  inline TimeDate& set_time_date(const Symbol& att);
754  inline TimeDate& set_time_date(const Symbol& att, TimeDate v);
755  inline TimeDate& set_ref_time_date(const Symbol& att, TimeDate& v);
756  inline const TimeDate& set_cref_time_date(const Symbol& att, const TimeDate& v);
757  inline const ListTimeDate& get_list_time_date(const Symbol& att) const;
758  inline const ListTimeDate* get_plist_time_date(const Symbol& att) const;
759  inline ListTimeDate& set_list_time_date(const Symbol& att);
760  inline ListTimeDate& set_list_time_date(const Symbol& att, const ListTimeDate& v);
761  inline ListTimeDate& set_ref_list_time_date(const Symbol& att, ListTimeDate& v);
762  inline const ListTimeDate& set_cref_list_time_date(const Symbol& att, const ListTimeDate& v);
763  inline void add_time_date(const Symbol& att, TimeDate v);
764 
765  inline TimePeriod get_time_period(const Symbol& att, TimePeriod pv = 0) const;
766  inline const TimePeriod* get_ptime_period(const Symbol& att) const;
767  inline TimePeriod& set_time_period(const Symbol& att);
768  inline TimePeriod& set_time_period(const Symbol& att, TimePeriod v);
769  inline TimePeriod& set_ref_time_period(const Symbol& att, TimePeriod& v);
770  inline const TimePeriod& set_cref_time_period(const Symbol& att, const TimePeriod& v);
771  inline const ListTimePeriod& get_list_time_period(const Symbol& att) const;
772  inline const ListTimePeriod* get_plist_time_period(const Symbol& att) const;
773  inline ListTimePeriod& set_list_time_period(const Symbol& att);
774  inline ListTimePeriod& set_list_time_period(const Symbol& att, const ListTimePeriod& v);
775  inline ListTimePeriod& set_ref_list_time_period(const Symbol& att, ListTimePeriod& v);
776  inline const ListTimePeriod& set_cref_list_time_period(const Symbol& att, const ListTimePeriod& v);
777  inline void add_time_period(const Symbol& att, TimePeriod v);
778 
779  inline const AString& get_astring(const Symbol& att) const;
780  inline const AString* get_pastring(const Symbol& att) const;
781  inline AString& set_astring(const Symbol& att);
782  inline AString& set_astring(const Symbol& att, const AString& v);
783  inline AString& set_ref_astring(const Symbol& att, AString& v);
784  inline const AString& set_cref_astring(const Symbol& att, const AString& v);
785  inline const ListAString& get_list_astring(const Symbol& att) const;
786  inline const ListAString* get_plist_astring(const Symbol& att) const;
787  inline ListAString& set_list_astring(const Symbol& att);
788  inline ListAString& set_list_astring(const Symbol& att, const ListAString& v);
789  inline ListAString& set_ref_list_astring(const Symbol& att, ListAString& v);
790  inline const ListAString& set_cref_list_astring(const Symbol& att, const ListAString& v);
791  inline AString& add_astring(const Symbol& att, const AString& v = AString());
792 
793  inline const String& get_string(const Symbol& att) const;
794  inline const String* get_pstring(const Symbol& att) const;
795  inline String& set_string(const Symbol& att);
796  inline String& set_string(const Symbol& att, const String& v);
797  inline String& set_ref_string(const Symbol& att, String& v);
798  inline const String& set_cref_string(const Symbol& att, const String& v);
799  inline const ListString& get_list_string(const Symbol& att) const;
800  inline const ListString* get_plist_string(const Symbol& att) const;
801  inline ListString& set_list_string(const Symbol& att);
802  inline ListString& set_list_string(const Symbol& att, const ListString& v);
803  inline ListString& set_ref_list_string(const Symbol& att, ListString& v);
804  inline const ListString& set_cref_list_string(const Symbol& att, const ListString& v);
805  inline String& add_string(const Symbol& att, const String& v = String());
806 
807  inline const StringBuffer& get_stringbuffer(const Symbol& att) const;
808  inline const StringBuffer* get_pstringbuffer(const Symbol& att) const;
809  inline StringBuffer& set_stringbuffer(const Symbol& att);
810  inline StringBuffer& set_stringbuffer(const Symbol& att, const StringBuffer& v);
811  inline StringBuffer& set_ref_stringbuffer(const Symbol& att, StringBuffer& v);
812  inline const StringBuffer& set_cref_stringbuffer(const Symbol& att, const StringBuffer& v);
813  inline const ListStringBuffer& get_list_stringbuffer(const Symbol& att) const;
814  inline const ListStringBuffer* get_plist_stringbuffer(const Symbol& att) const;
815  inline ListStringBuffer& set_list_stringbuffer(const Symbol& att);
816  inline ListStringBuffer& set_list_stringbuffer(const Symbol& att, const ListStringBuffer& v);
817  inline ListStringBuffer& set_ref_list_stringbuffer(const Symbol& att, ListStringBuffer& v);
818  inline const ListStringBuffer& set_cref_list_stringbuffer(const Symbol& att, const ListStringBuffer& v);
819  inline StringBuffer& add_stringbuffer(const Symbol& att, const StringBuffer& v = StringBuffer());
820 
821  inline const Blob& get_blob(const Symbol& att) const;
822  inline const Blob* get_pblob(const Symbol& att) const;
823  inline Blob& set_blob(const Symbol& att);
824  inline Blob& set_blob(const Symbol& att, const Blob& v);
825  inline Blob& set_ref_blob(const Symbol& att, Blob& v);
826  inline const Blob& set_cref_blob(const Symbol& att, const Blob& v);
827  inline const ListBlob& get_list_blob(const Symbol& att) const;
828  inline const ListBlob* get_plist_blob(const Symbol& att) const;
829  inline ListBlob& set_list_blob(const Symbol& att);
830  inline ListBlob& set_list_blob(const Symbol& att, const ListBlob& v);
831  inline ListBlob& set_ref_list_blob(const Symbol& att, ListBlob& v);
832  inline const ListBlob& set_cref_list_blob(const Symbol& att, const ListBlob& v);
833  inline Blob& add_blob(const Symbol& att, const Blob& v = Blob());
834 
835  inline const Tuple& get_tuple(const Symbol& att) const;
836  inline const Tuple* get_ptuple(const Symbol& att) const;
837  inline Tuple& set_tuple(const Symbol& att);
838  inline Tuple& set_tuple(const Symbol& att, const Tuple& v);
839  inline Tuple& set_ref_tuple(const Symbol& att, Tuple& v);
840  inline const Tuple& set_cref_tuple(const Symbol& att, const Tuple& v);
841  inline const ListTuple& get_list_tuple(const Symbol& att) const;
842  inline const ListTuple* get_plist_tuple(const Symbol& att) const;
843  inline ListTuple& set_list_tuple(const Symbol& att);
844  inline ListTuple& set_list_tuple(const Symbol& att, const ListTuple& v);
845  inline ListTuple& set_ref_list_tuple(const Symbol& att, ListTuple& v);
846  inline const ListTuple& set_cref_list_tuple(const Symbol& att, const ListTuple& v);
847  inline Tuple& add_tuple(const Symbol& att, const Tuple& v = Tuple());
848 
849 
850  inline const ArrayInt& get_array_int(const Symbol& att) const;
851  inline const ArrayInt* get_parray_int(const Symbol& att) const;
852  inline ArrayInt& set_array_int(const Symbol& att);
853  inline ArrayInt& set_array_int(const Symbol& att, const ArrayInt& v);
854  inline ArrayInt& set_ref_array_int(const Symbol& att, ArrayInt& v);
855  inline const ArrayInt& set_cref_array_int(const Symbol& att, const ArrayInt& v);
856  inline const ListArrayInt& get_list_array_int(const Symbol& att) const;
857  inline const ListArrayInt* get_plist_array_int(const Symbol& att) const;
858  inline ListArrayInt& set_list_array_int(const Symbol& att);
859  inline ListArrayInt& set_list_array_int(const Symbol& att, const ListArrayInt& v);
860  inline ListArrayInt& set_ref_list_array_int(const Symbol& att, ListArrayInt& v);
861  inline const ListArrayInt& set_cref_list_array_int(const Symbol& att, const ListArrayInt& v);
862  inline ArrayInt& add_array_int(const Symbol& att, const ArrayInt& v = ArrayInt());
863 
864  inline const ArrayLong& get_array_long(const Symbol& att) const;
865  inline const ArrayLong* get_parray_long(const Symbol& att) const;
866  inline ArrayLong& set_array_long(const Symbol& att);
867  inline ArrayLong& set_array_long(const Symbol& att, const ArrayLong& v);
868  inline ArrayLong& set_ref_array_long(const Symbol& att, ArrayLong& v);
869  inline const ArrayLong& set_cref_array_long(const Symbol& att, const ArrayLong& v);
870  inline const ListArrayLong& get_list_array_long(const Symbol& att) const;
871  inline const ListArrayLong* get_plist_array_long(const Symbol& att) const;
872  inline ListArrayLong& set_list_array_long(const Symbol& att);
873  inline ListArrayLong& set_list_array_long(const Symbol& att, const ListArrayLong& v);
874  inline ListArrayLong& set_ref_list_array_long(const Symbol& att, ListArrayLong& v);
875  inline const ListArrayLong& set_cref_list_array_long(const Symbol& att, const ListArrayLong& v);
876  inline ArrayLong& add_array_long(const Symbol& att, const ArrayLong& v = ArrayLong());
877 
878  inline const ArrayFloat& get_array_float(const Symbol& att) const;
879  inline const ArrayFloat* get_parray_float(const Symbol& att) const;
880  inline ArrayFloat& set_array_float(const Symbol& att);
881  inline ArrayFloat& set_array_float(const Symbol& att, const ArrayFloat& v);
882  inline ArrayFloat& set_ref_array_float(const Symbol& att, ArrayFloat& v);
883  inline const ArrayFloat& set_cref_array_float(const Symbol& att, const ArrayFloat& v);
884  inline const ListArrayFloat& get_list_array_float(const Symbol& att) const;
885  inline const ListArrayFloat* get_plist_array_float(const Symbol& att) const;
886  inline ListArrayFloat& set_list_array_float(const Symbol& att);
887  inline ListArrayFloat& set_list_array_float(const Symbol& att, const ListArrayFloat& v);
888  inline ListArrayFloat& set_ref_list_array_float(const Symbol& att, ListArrayFloat& v);
889  inline const ListArrayFloat& set_cref_list_array_float(const Symbol& att, const ListArrayFloat& v);
890  inline ArrayFloat& add_array_float(const Symbol& att, const ArrayFloat& v = ArrayFloat());
891 
892  inline const ArrayDouble& get_array_double(const Symbol& att) const;
893  inline const ArrayDouble* get_parray_double(const Symbol& att) const;
894  inline ArrayDouble& set_array_double(const Symbol& att);
895  inline ArrayDouble& set_array_double(const Symbol& att, const ArrayDouble& v);
896  inline ArrayDouble& set_ref_array_double(const Symbol& att, ArrayDouble& v);
897  inline const ArrayDouble& set_cref_array_double(const Symbol& att, const ArrayDouble& v);
898  inline const ListArrayDouble& get_list_array_double(const Symbol& att) const;
899  inline const ListArrayDouble* get_plist_array_double(const Symbol& att) const;
900  inline ListArrayDouble& set_list_array_double(const Symbol& att);
901  inline ListArrayDouble& set_list_array_double(const Symbol& att, const ListArrayDouble& v);
902  inline ListArrayDouble& set_ref_list_array_double(const Symbol& att, ListArrayDouble& v);
903  inline const ListArrayDouble& set_cref_list_array_double(const Symbol& att, const ListArrayDouble& v);
904  inline ArrayDouble& add_array_double(const Symbol& att, const ArrayDouble& v = ArrayDouble());
906 
917  bool match(const AString& pattern, IBStream& source);
918  bool match(const AString& pattern, const AString& source);
919  bool match(const AString& pattern, IBStream& source, AChar esc);
920  bool match(const AString& pattern, const AString& source, AChar esc);
922 
926  long read(const CommBuffer& buf);
930  long write(CommBuffer& buf) const;
931 
935  long read_xml(IBStream& i);
936  long read_xml(XmlParser& i);
942  long write_xml(OBStream& o, const AChar* att = 0) const;
943 
947  long write_xml(const Path& file_name) const;
951  long read_xml(const Path& file_name);
952 
956  long write_xml(StringBuffer& s) const;
960  long read_xml(const StringBuffer& s);
961 
962 
968  AString& format(const AChar* format, AString& s) const;
974  long format(const AChar* format, OBStream& o) const;
975 
979  bool equal(const Tuple& tuple) const;
983  int compare(const Tuple& t) const;
987  bool operator== (const Tuple& t) const { return equal(t); }
988  bool operator!= (const Tuple& t) const { return !equal(t); }
989  bool operator< (const Tuple& t) const { return compare(t) < 0; }
990  bool operator> (const Tuple& t) const { return compare(t) > 0; }
992  private:
993  PValue get_value(const Symbol& att) const;
994  PValue get_value(const Symbol& att, Types type) const;
995  void* get_pvalue(const Symbol& att, Types type, bool nodef = true) const;
996 
997  PValue set_value(PValue value);
998 
999  PValue set_value(const Symbol& att, Types type, const void* value = 0, bool ref = false, bool cnst = false);
1000  void add_value_item(PValue value);
1001  private:
1002  Symbol symbolClass_;
1003  PValue valueList_;
1004  };
1005 
1006 
1007  inline Bool& Tuple::set_bool(const Symbol& att, Bool v)
1008  {
1009  PValue value = set_value(att, T_BOOL, &v, false);
1010  return *(Bool*)value->get_pvalue();
1011  }
1012  inline Bool& Tuple::set_ref_bool(const Symbol& att, Bool& v)
1013  {
1014  set_value(att, T_BOOL, &v, true);
1015  return v;
1016  }
1017  inline const Bool& Tuple::set_cref_bool(const Symbol& att, const Bool& v)
1018  {
1019  set_value(att, T_BOOL, &v, true, true);
1020  return v;
1021  }
1022  inline Bool& Tuple::set_bool(const Symbol& att)
1023  {
1024  Bool v = false;
1025  PValue value = set_value(att, T_BOOL, &v, false);
1026  return *(Bool*)value->get_pvalue();
1027  }
1028  inline ListBool& Tuple::set_list_bool(const Symbol& att, const ListBool& v)
1029  {
1030  PValue value = set_value(att, T_LIST_BOOL, (void*)&v, false);
1031  return *(ListBool*)value->get_pvalue();
1032  }
1033  inline ListBool& Tuple::set_ref_list_bool(const Symbol& att, ListBool& v)
1034  {
1035  set_value(att, T_LIST_BOOL, (void*)&v, true);
1036  return v;
1037  }
1038  inline const ListBool& Tuple::set_cref_list_bool(const Symbol& att, const ListBool& v)
1039  {
1040  set_value(att, T_LIST_BOOL, (void*)&v, true, true);
1041  return v;
1042  }
1043  inline ListBool& Tuple::set_list_bool(const Symbol& att)
1044  {
1045  PValue value = set_value(att, T_LIST_BOOL, (void*)0, false);
1046  return *(ListBool*)value->get_pvalue();
1047  }
1048  inline void Tuple::add_bool(const Symbol& att, Bool v)
1049  {
1050  ((ListBool*)set_value(att, T_LIST_BOOL, (void*)0, false)->get_pvalue())->add(v);
1051  }
1052  inline Bool Tuple::get_bool(const Symbol& att, Bool v) const
1053  {
1054  if (Value* value = get_value(att, T_BOOL))
1055  {
1056  return *(Bool*)value->get_pvalue();
1057  }
1058  else
1059  {
1060  return v;
1061  }
1062  }
1063  inline const Bool* Tuple::get_pbool(const Symbol& att) const
1064  {
1065  if (Value* value = get_value(att, T_BOOL))
1066  {
1067  return (const Bool*)value->get_pvalue();
1068  }
1069  else
1070  {
1071  return 0;
1072  }
1073  }
1074  inline const ListBool& Tuple::get_list_bool(const Symbol& att) const
1075  {
1076  return *(const ListBool*)get_pvalue(att, T_LIST_BOOL, false);
1077  }
1078  inline const ListBool* Tuple::get_plist_bool(const Symbol& att) const
1079  {
1080  if (Value* value = get_value(att, T_LIST_BOOL))
1081  {
1082  return (const ListBool*)value->get_pvalue();
1083  }
1084  else
1085  {
1086  return 0;
1087  }
1088  };
1089 
1090  inline Int& Tuple::set_int(const Symbol& att, Int v)
1091  {
1092  PValue value = set_value(att, T_INT, &v, false);
1093  return *(Int*)value->get_pvalue();
1094  }
1095  inline Int& Tuple::set_ref_int(const Symbol& att, Int& v)
1096  {
1097  set_value(att, T_INT, &v, true);
1098  return v;
1099  }
1100  inline const Int& Tuple::set_cref_int(const Symbol& att, const Int& v)
1101  {
1102  set_value(att, T_INT, &v, true, true);
1103  return v;
1104  }
1105  inline Int& Tuple::set_int(const Symbol& att)
1106  {
1107  Int v = 0;
1108  PValue value = set_value(att, T_INT, &v, false);
1109  return *(Int*)value->get_pvalue();
1110  }
1111  inline ListInt& Tuple::set_list_int(const Symbol& att, const ListInt& v)
1112  {
1113  PValue value = set_value(att, T_LIST_INT, (void*)&v, false);
1114  return *(ListInt*)value->get_pvalue();
1115  }
1116  inline ListInt& Tuple::set_ref_list_int(const Symbol& att, ListInt& v)
1117  {
1118  set_value(att, T_LIST_INT, (void*)&v, true);
1119  return v;
1120  }
1121  inline const ListInt& Tuple::set_cref_list_int(const Symbol& att, const ListInt& v)
1122  {
1123  set_value(att, T_LIST_INT, (void*)&v, true, true);
1124  return v;
1125  }
1126  inline ListInt& Tuple::set_list_int(const Symbol& att)
1127  {
1128  PValue value = set_value(att, T_LIST_INT, (void*)0, false);
1129  return *(ListInt*)value->get_pvalue();
1130  }
1131  inline void Tuple::add_int(const Symbol& att, Int v)
1132  {
1133  ((ListInt*)set_value(att, T_LIST_INT, (void*)0, false)->get_pvalue())->add(v);
1134  }
1135  inline Int Tuple::get_int(const Symbol& att, Int v) const
1136  {
1137  if (Value* value = get_value(att, T_INT))
1138  {
1139  return *(Int*)value->get_pvalue();
1140  }
1141  else
1142  {
1143  return v;
1144  }
1145  }
1146  inline const Int* Tuple::get_pint(const Symbol& att) const
1147  {
1148  if (Value* value = get_value(att, T_INT))
1149  {
1150  return (const Int*)value->get_pvalue();
1151  }
1152  else
1153  {
1154  return 0;
1155  }
1156  }
1157  inline const ListInt& Tuple::get_list_int(const Symbol& att) const
1158  {
1159  return *(const ListInt*)get_pvalue(att, T_LIST_INT, false);
1160  }
1161  inline const ListInt* Tuple::get_plist_int(const Symbol& att) const
1162  {
1163  if (Value* value = get_value(att, T_LIST_INT))
1164  {
1165  return (const ListInt*)value->get_pvalue();
1166  }
1167  else
1168  {
1169  return 0;
1170  }
1171  };
1172 
1173  inline Long& Tuple::set_long(const Symbol& att, Long v)
1174  {
1175  PValue value = set_value(att, T_LONG, &v, false);
1176  return *(Long*)value->get_pvalue();
1177  }
1178  inline Long& Tuple::set_ref_long(const Symbol& att, Long& v)
1179  {
1180  set_value(att, T_LONG, &v, true);
1181  return v;
1182  }
1183  inline const Long& Tuple::set_cref_long(const Symbol& att, const Long& v)
1184  {
1185  set_value(att, T_LONG, &v, true, true);
1186  return v;
1187  }
1188  inline Long& Tuple::set_long(const Symbol& att)
1189  {
1190  Long v = 0;
1191  PValue value = set_value(att, T_LONG, &v, false);
1192  return *(Long*)value->get_pvalue();
1193  }
1194  inline ListLong& Tuple::set_list_long(const Symbol& att, const ListLong& v)
1195  {
1196  PValue value = set_value(att, T_LIST_LONG, (void*)&v, false);
1197  return *(ListLong*)value->get_pvalue();
1198  }
1199  inline ListLong& Tuple::set_ref_list_long(const Symbol& att, ListLong& v)
1200  {
1201  set_value(att, T_LIST_LONG, (void*)&v, true);
1202  return v;
1203  }
1204  inline const ListLong& Tuple::set_cref_list_long(const Symbol& att, const ListLong& v)
1205  {
1206  set_value(att, T_LIST_LONG, (void*)&v, true, true);
1207  return v;
1208  }
1209  inline ListLong& Tuple::set_list_long(const Symbol& att)
1210  {
1211  PValue value = set_value(att, T_LIST_LONG, (void*)0, false);
1212  return *(ListLong*)value->get_pvalue();
1213  }
1214  inline void Tuple::add_long(const Symbol& att, Long v)
1215  {
1216  ((ListLong*)set_value(att, T_LIST_LONG, (void*)0, false)->get_pvalue())->add(v);
1217  }
1218  inline Long Tuple::get_long(const Symbol& att, Long v) const
1219  {
1220  if (Value* value = get_value(att, T_LONG))
1221  {
1222  return *(Long*)value->get_pvalue();
1223  }
1224  else
1225  {
1226  return v;
1227  }
1228  }
1229  inline const Long* Tuple::get_plong(const Symbol& att) const
1230  {
1231  if (Value* value = get_value(att, T_LONG))
1232  {
1233  return (const Long*)value->get_pvalue();
1234  }
1235  else
1236  {
1237  return 0;
1238  }
1239  }
1240  inline const ListLong& Tuple::get_list_long(const Symbol& att) const
1241  {
1242  return *(const ListLong*)get_pvalue(att, T_LIST_LONG, false);
1243  }
1244  inline const ListLong* Tuple::get_plist_long(const Symbol& att) const
1245  {
1246  if (Value* value = get_value(att, T_LIST_LONG))
1247  {
1248  return (const ListLong*)value->get_pvalue();
1249  }
1250  else
1251  {
1252  return 0;
1253  }
1254  };
1255 
1256  inline Float& Tuple::set_float(const Symbol& att, Float v)
1257  {
1258  PValue value = set_value(att, T_FLOAT, &v, false);
1259  return *(Float*)value->get_pvalue();
1260  }
1261  inline Float& Tuple::set_ref_float(const Symbol& att, Float& v)
1262  {
1263  set_value(att, T_FLOAT, &v, true);
1264  return v;
1265  }
1266  inline const Float& Tuple::set_cref_float(const Symbol& att, const Float& v)
1267  {
1268  set_value(att, T_FLOAT, &v, true, true);
1269  return v;
1270  }
1271  inline Float& Tuple::set_float(const Symbol& att)
1272  {
1273  Float v = 0;
1274  PValue value = set_value(att, T_FLOAT, &v, false);
1275  return *(Float*)value->get_pvalue();
1276  }
1277  inline ListFloat& Tuple::set_list_float(const Symbol& att, const ListFloat& v)
1278  {
1279  PValue value = set_value(att, T_LIST_FLOAT, (void*)&v, false);
1280  return *(ListFloat*)value->get_pvalue();
1281  }
1282  inline ListFloat& Tuple::set_ref_list_float(const Symbol& att, ListFloat& v)
1283  {
1284  set_value(att, T_LIST_FLOAT, (void*)&v, true);
1285  return v;
1286  }
1287  inline const ListFloat& Tuple::set_cref_list_float(const Symbol& att, const ListFloat& v)
1288  {
1289  set_value(att, T_LIST_FLOAT, (void*)&v, true, true);
1290  return v;
1291  }
1292  inline ListFloat& Tuple::set_list_float(const Symbol& att)
1293  {
1294  PValue value = set_value(att, T_LIST_FLOAT, (void*)0, false);
1295  return *(ListFloat*)value->get_pvalue();
1296  }
1297  inline void Tuple::add_float(const Symbol& att, Float v)
1298  {
1299  ((ListFloat*)set_value(att, T_LIST_FLOAT, (void*)0, false)->get_pvalue())->add(v);
1300  }
1301  inline Float Tuple::get_float(const Symbol& att, Float v) const
1302  {
1303  if (Value* value = get_value(att, T_FLOAT))
1304  {
1305  return *(Float*)value->get_pvalue();
1306  }
1307  else
1308  {
1309  return v;
1310  }
1311  }
1312  inline const Float* Tuple::get_pfloat(const Symbol& att) const
1313  {
1314  if (Value* value = get_value(att, T_FLOAT))
1315  {
1316  return (const Float*)value->get_pvalue();
1317  }
1318  else
1319  {
1320  return 0;
1321  }
1322  }
1323  inline const ListFloat& Tuple::get_list_float(const Symbol& att) const
1324  {
1325  return *(const ListFloat*)get_pvalue(att, T_LIST_FLOAT, false);
1326  }
1327  inline const ListFloat* Tuple::get_plist_float(const Symbol& att) const
1328  {
1329  if (Value* value = get_value(att, T_LIST_FLOAT))
1330  {
1331  return (const ListFloat*)value->get_pvalue();
1332  }
1333  else
1334  {
1335  return 0;
1336  }
1337  };
1338 
1339  inline Double& Tuple::set_double(const Symbol& att, Double v)
1340  {
1341  PValue value = set_value(att, T_DOUBLE, &v, false);
1342  return *(Double*)value->get_pvalue();
1343  }
1344  inline Double& Tuple::set_ref_double(const Symbol& att, Double& v)
1345  {
1346  set_value(att, T_DOUBLE, &v, true);
1347  return v;
1348  }
1349  inline const Double& Tuple::set_cref_double(const Symbol& att, const Double& v)
1350  {
1351  set_value(att, T_DOUBLE, &v, true, true);
1352  return v;
1353  }
1354  inline Double& Tuple::set_double(const Symbol& att)
1355  {
1356  Double v = 0;
1357  PValue value = set_value(att, T_DOUBLE, &v, false);
1358  return *(Double*)value->get_pvalue();
1359  }
1360  inline ListDouble& Tuple::set_list_double(const Symbol& att, const ListDouble& v)
1361  {
1362  PValue value = set_value(att, T_LIST_DOUBLE, (void*)&v, false);
1363  return *(ListDouble*)value->get_pvalue();
1364  }
1365  inline ListDouble& Tuple::set_ref_list_double(const Symbol& att, ListDouble& v)
1366  {
1367  set_value(att, T_LIST_DOUBLE, (void*)&v, true);
1368  return v;
1369  }
1370  inline const ListDouble& Tuple::set_cref_list_double(const Symbol& att, const ListDouble& v)
1371  {
1372  set_value(att, T_LIST_DOUBLE, (void*)&v, true, true);
1373  return v;
1374  }
1375  inline ListDouble& Tuple::set_list_double(const Symbol& att)
1376  {
1377  PValue value = set_value(att, T_LIST_DOUBLE, (void*)0, false);
1378  return *(ListDouble*)value->get_pvalue();
1379  }
1380  inline void Tuple::add_double(const Symbol& att, Double v)
1381  {
1382  ((ListDouble*)set_value(att, T_LIST_DOUBLE, (void*)0, false)->get_pvalue())->add(v);
1383  }
1384  inline Double Tuple::get_double(const Symbol& att, Double v) const
1385  {
1386  if (Value* value = get_value(att, T_DOUBLE))
1387  {
1388  return *(Double*)value->get_pvalue();
1389  }
1390  else
1391  {
1392  return v;
1393  }
1394  }
1395  inline const Double* Tuple::get_pdouble(const Symbol& att) const
1396  {
1397  if (Value* value = get_value(att, T_DOUBLE))
1398  {
1399  return (const Double*)value->get_pvalue();
1400  }
1401  else
1402  {
1403  return 0;
1404  }
1405  }
1406  inline const ListDouble& Tuple::get_list_double(const Symbol& att) const
1407  {
1408  return *(const ListDouble*)get_pvalue(att, T_LIST_DOUBLE, false);
1409  }
1410  inline const ListDouble* Tuple::get_plist_double(const Symbol& att) const
1411  {
1412  if (Value* value = get_value(att, T_LIST_DOUBLE))
1413  {
1414  return (const ListDouble*)value->get_pvalue();
1415  }
1416  else
1417  {
1418  return 0;
1419  }
1420  };
1421 
1422  inline TimeDate& Tuple::set_time_date(const Symbol& att, TimeDate v)
1423  {
1424  PValue value = set_value(att, T_TIME_DATE, &v, false);
1425  return *(TimeDate*)value->get_pvalue();
1426  }
1427  inline TimeDate& Tuple::set_ref_time_date(const Symbol& att, TimeDate& v)
1428  {
1429  set_value(att, T_TIME_DATE, &v, true);
1430  return v;
1431  }
1432  inline const TimeDate& Tuple::set_cref_time_date(const Symbol& att, const TimeDate& v)
1433  {
1434  set_value(att, T_TIME_DATE, &v, true, true);
1435  return v;
1436  }
1437  inline TimeDate& Tuple::set_time_date(const Symbol& att)
1438  {
1439  TimeDate v = 0;
1440  PValue value = set_value(att, T_TIME_DATE, &v, false);
1441  return *(TimeDate*)value->get_pvalue();
1442  }
1443  inline ListTimeDate& Tuple::set_list_time_date(const Symbol& att, const ListTimeDate& v)
1444  {
1445  PValue value = set_value(att, T_LIST_TIME_DATE, (void*)&v, false);
1446  return *(ListTimeDate*)value->get_pvalue();
1447  }
1448  inline ListTimeDate& Tuple::set_ref_list_time_date(const Symbol& att, ListTimeDate& v)
1449  {
1450  set_value(att, T_LIST_TIME_DATE, (void*)&v, true);
1451  return v;
1452  }
1453  inline const ListTimeDate& Tuple::set_cref_list_time_date(const Symbol& att, const ListTimeDate& v)
1454  {
1455  set_value(att, T_LIST_TIME_DATE, (void*)&v, true, true);
1456  return v;
1457  }
1458  inline ListTimeDate& Tuple::set_list_time_date(const Symbol& att)
1459  {
1460  PValue value = set_value(att, T_LIST_TIME_DATE, (void*)0, false);
1461  return *(ListTimeDate*)value->get_pvalue();
1462  }
1463  inline void Tuple::add_time_date(const Symbol& att, TimeDate v)
1464  {
1465  ((ListTimeDate*)set_value(att, T_LIST_TIME_DATE, (void*)0, false)->get_pvalue())->add(v);
1466  }
1467  inline TimeDate Tuple::get_time_date(const Symbol& att, TimeDate v) const
1468  {
1469  if (Value* value = get_value(att, T_TIME_DATE))
1470  {
1471  return *(TimeDate*)value->get_pvalue();
1472  }
1473  else
1474  {
1475  return v;
1476  }
1477  }
1478  inline const TimeDate* Tuple::get_ptime_date(const Symbol& att) const
1479  {
1480  if (Value* value = get_value(att, T_TIME_DATE))
1481  {
1482  return (const TimeDate*)value->get_pvalue();
1483  }
1484  else
1485  {
1486  return 0;
1487  }
1488  }
1489  inline const ListTimeDate& Tuple::get_list_time_date(const Symbol& att) const
1490  {
1491  return *(const ListTimeDate*)get_pvalue(att, T_LIST_TIME_DATE, false);
1492  }
1493  inline const ListTimeDate* Tuple::get_plist_time_date(const Symbol& att) const
1494  {
1495  if (Value* value = get_value(att, T_LIST_TIME_DATE))
1496  {
1497  return (const ListTimeDate*)value->get_pvalue();
1498  }
1499  else
1500  {
1501  return 0;
1502  }
1503  };
1504 
1505  inline TimePeriod& Tuple::set_time_period(const Symbol& att, TimePeriod v)
1506  {
1507  PValue value = set_value(att, T_TIME_PERIOD, &v, false);
1508  return *(TimePeriod*)value->get_pvalue();
1509  }
1510  inline TimePeriod& Tuple::set_ref_time_period(const Symbol& att, TimePeriod& v)
1511  {
1512  set_value(att, T_TIME_PERIOD, &v, true);
1513  return v;
1514  }
1515  inline const TimePeriod& Tuple::set_cref_time_period(const Symbol& att, const TimePeriod& v)
1516  {
1517  set_value(att, T_TIME_PERIOD, &v, true, true);
1518  return v;
1519  }
1520  inline TimePeriod& Tuple::set_time_period(const Symbol& att)
1521  {
1522  TimePeriod v = 0;
1523  PValue value = set_value(att, T_TIME_PERIOD, &v, false);
1524  return *(TimePeriod*)value->get_pvalue();
1525  }
1526  inline ListTimePeriod& Tuple::set_list_time_period(const Symbol& att, const ListTimePeriod& v)
1527  {
1528  PValue value = set_value(att, T_LIST_TIME_PERIOD, (void*)&v, false);
1529  return *(ListTimePeriod*)value->get_pvalue();
1530  }
1531  inline ListTimePeriod& Tuple::set_ref_list_time_period(const Symbol& att, ListTimePeriod& v)
1532  {
1533  set_value(att, T_LIST_TIME_PERIOD, (void*)&v, true);
1534  return v;
1535  }
1536  inline const ListTimePeriod& Tuple::set_cref_list_time_period(const Symbol& att, const ListTimePeriod& v)
1537  {
1538  set_value(att, T_LIST_TIME_PERIOD, (void*)&v, true, true);
1539  return v;
1540  }
1541  inline ListTimePeriod& Tuple::set_list_time_period(const Symbol& att)
1542  {
1543  PValue value = set_value(att, T_LIST_TIME_PERIOD, (void*)0, false);
1544  return *(ListTimePeriod*)value->get_pvalue();
1545  }
1546  inline void Tuple::add_time_period(const Symbol& att, TimePeriod v)
1547  {
1548  ((ListTimePeriod*)set_value(att, T_LIST_TIME_PERIOD, (void*)0, false)->get_pvalue())->add(v);
1549  }
1550  inline TimePeriod Tuple::get_time_period(const Symbol& att, TimePeriod v) const
1551  {
1552  if (Value* value = get_value(att, T_TIME_PERIOD))
1553  {
1554  return *(TimePeriod*)value->get_pvalue();
1555  }
1556  else
1557  {
1558  return v;
1559  }
1560  }
1561  inline const TimePeriod* Tuple::get_ptime_period(const Symbol& att) const
1562  {
1563  if (Value* value = get_value(att, T_TIME_PERIOD))
1564  {
1565  return (const TimePeriod*)value->get_pvalue();
1566  }
1567  else
1568  {
1569  return 0;
1570  }
1571  }
1572  inline const ListTimePeriod& Tuple::get_list_time_period(const Symbol& att) const
1573  {
1574  return *(const ListTimePeriod*)get_pvalue(att, T_LIST_TIME_PERIOD, false);
1575  }
1576  inline const ListTimePeriod* Tuple::get_plist_time_period(const Symbol& att) const
1577  {
1578  if (Value* value = get_value(att, T_LIST_TIME_PERIOD))
1579  {
1580  return (const ListTimePeriod*)value->get_pvalue();
1581  }
1582  else
1583  {
1584  return 0;
1585  }
1586  };
1587 
1588  inline AString& Tuple::set_astring(const Symbol& att, const AString& v)
1589  {
1590  PValue value = set_value(att, T_ASTRING, (void*)&v, false);
1591  return *(AString*)value->get_pvalue();
1592  }
1593  inline AString& Tuple::set_ref_astring(const Symbol& att, AString& v)
1594  {
1595  set_value(att, T_ASTRING, (void*)&v, true);
1596  return v;
1597  }
1598  inline const AString& Tuple::set_cref_astring(const Symbol& att, const AString& v)
1599  {
1600  set_value(att, T_ASTRING, (const void*)&v, true, true);
1601  return v;
1602  }
1603  inline AString& Tuple::set_astring(const Symbol& att)
1604  {
1605  PValue value = set_value(att, T_ASTRING, 0, false);
1606  return *(AString*)value->get_pvalue();
1607  }
1608  inline ListAString& Tuple::set_list_astring(const Symbol& att, const ListAString& v)
1609  {
1610  PValue value = set_value(att, T_LIST_ASTRING, (void*)&v, false);
1611  return *(ListAString*)value->get_pvalue();
1612  }
1613  inline ListAString& Tuple::set_list_astring(const Symbol& att)
1614  {
1615  PValue value = set_value(att, T_LIST_ASTRING, (void*)0, false);
1616  return *(ListAString*)value->get_pvalue();
1617  }
1618  inline ListAString& Tuple::set_ref_list_astring(const Symbol& att, ListAString& v)
1619  {
1620  set_value(att, T_LIST_ASTRING, (void*)&v, true);
1621  return v;
1622  }
1623  inline const ListAString& Tuple::set_cref_list_astring(const Symbol& att, const ListAString& v)
1624  {
1625  set_value(att, T_LIST_ASTRING, (const void*)&v, true, true);
1626  return v;
1627  }
1628  inline AString& Tuple::add_astring(const Symbol& att, const AString& v)
1629  {
1630  return ((ListAString*)set_value(att, T_LIST_ASTRING, (void*)0, false)->get_pvalue())->add(v);
1631  }
1632  inline const AString& Tuple::get_astring(const Symbol& att) const
1633  {
1634  return *(const AString*)get_pvalue(att, T_ASTRING, false);
1635  }
1636  inline const AString* Tuple::get_pastring(const Symbol& att) const
1637  {
1638  if (Value* value = get_value(att, T_ASTRING))
1639  {
1640  return (const AString*)value->get_pvalue();
1641  }
1642  else
1643  {
1644  return 0;
1645  }
1646  }
1647  inline const ListAString& Tuple::get_list_astring(const Symbol& att) const
1648  {
1649  return *(const ListAString*)get_pvalue(att, T_LIST_ASTRING, false);
1650  }
1651  inline const ListAString* Tuple::get_plist_astring(const Symbol& att) const
1652  {
1653  if (Value* value = get_value(att, T_LIST_ASTRING))
1654  {
1655  return (const ListAString*)value->get_pvalue();
1656  }
1657  else
1658  {
1659  return 0;
1660  }
1661  };
1662 
1663  inline String& Tuple::set_string(const Symbol& att, const String& v)
1664  {
1665  PValue value = set_value(att, T_STRING, (void*)&v, false);
1666  return *(String*)value->get_pvalue();
1667  }
1668  inline String& Tuple::set_ref_string(const Symbol& att, String& v)
1669  {
1670  set_value(att, T_STRING, (void*)&v, true);
1671  return v;
1672  }
1673  inline const String& Tuple::set_cref_string(const Symbol& att, const String& v)
1674  {
1675  set_value(att, T_STRING, (const void*)&v, true, true);
1676  return v;
1677  }
1678  inline String& Tuple::set_string(const Symbol& att)
1679  {
1680  PValue value = set_value(att, T_STRING, 0, false);
1681  return *(String*)value->get_pvalue();
1682  }
1683  inline ListString& Tuple::set_list_string(const Symbol& att, const ListString& v)
1684  {
1685  PValue value = set_value(att, T_LIST_STRING, (void*)&v, false);
1686  return *(ListString*)value->get_pvalue();
1687  }
1688  inline ListString& Tuple::set_list_string(const Symbol& att)
1689  {
1690  PValue value = set_value(att, T_LIST_STRING, (void*)0, false);
1691  return *(ListString*)value->get_pvalue();
1692  }
1693  inline ListString& Tuple::set_ref_list_string(const Symbol& att, ListString& v)
1694  {
1695  set_value(att, T_LIST_STRING, (void*)&v, true);
1696  return v;
1697  }
1698  inline const ListString& Tuple::set_cref_list_string(const Symbol& att, const ListString& v)
1699  {
1700  set_value(att, T_LIST_STRING, (const void*)&v, true, true);
1701  return v;
1702  }
1703  inline String& Tuple::add_string(const Symbol& att, const String& v)
1704  {
1705  return ((ListString*)set_value(att, T_LIST_STRING, (void*)0, false)->get_pvalue())->add(v);
1706  }
1707  inline const String& Tuple::get_string(const Symbol& att) const
1708  {
1709  return *(const String*)get_pvalue(att, T_STRING, false);
1710  }
1711  inline const String* Tuple::get_pstring(const Symbol& att) const
1712  {
1713  if (Value* value = get_value(att, T_STRING))
1714  {
1715  return (const String*)value->get_pvalue();
1716  }
1717  else
1718  {
1719  return 0;
1720  }
1721  }
1722  inline const ListString& Tuple::get_list_string(const Symbol& att) const
1723  {
1724  return *(const ListString*)get_pvalue(att, T_LIST_STRING, false);
1725  }
1726  inline const ListString* Tuple::get_plist_string(const Symbol& att) const
1727  {
1728  if (Value* value = get_value(att, T_LIST_STRING))
1729  {
1730  return (const ListString*)value->get_pvalue();
1731  }
1732  else
1733  {
1734  return 0;
1735  }
1736  };
1737 
1738  inline Tuple& Tuple::set_tuple(const Symbol& att, const Tuple& v)
1739  {
1740  PValue value = set_value(att, T_TUPLE, (void*)&v, false);
1741  return *(Tuple*)value->get_pvalue();
1742  }
1743  inline Tuple& Tuple::set_ref_tuple(const Symbol& att, Tuple& v)
1744  {
1745  set_value(att, T_TUPLE, (void*)&v, true);
1746  return v;
1747  }
1748  inline const Tuple& Tuple::set_cref_tuple(const Symbol& att, const Tuple& v)
1749  {
1750  set_value(att, T_TUPLE, (const void*)&v, true, true);
1751  return v;
1752  }
1753  inline Tuple& Tuple::set_tuple(const Symbol& att)
1754  {
1755  PValue value = set_value(att, T_TUPLE, 0, false);
1756  return *(Tuple*)value->get_pvalue();
1757  }
1758  inline ListTuple& Tuple::set_list_tuple(const Symbol& att, const ListTuple& v)
1759  {
1760  PValue value = set_value(att, T_LIST_TUPLE, (void*)&v, false);
1761  return *(ListTuple*)value->get_pvalue();
1762  }
1763  inline ListTuple& Tuple::set_list_tuple(const Symbol& att)
1764  {
1765  PValue value = set_value(att, T_LIST_TUPLE, (void*)0, false);
1766  return *(ListTuple*)value->get_pvalue();
1767  }
1768  inline ListTuple& Tuple::set_ref_list_tuple(const Symbol& att, ListTuple& v)
1769  {
1770  set_value(att, T_LIST_TUPLE, (void*)&v, true);
1771  return v;
1772  }
1773  inline const ListTuple& Tuple::set_cref_list_tuple(const Symbol& att, const ListTuple& v)
1774  {
1775  set_value(att, T_LIST_TUPLE, (const void*)&v, true, true);
1776  return v;
1777  }
1778  inline Tuple& Tuple::add_tuple(const Symbol& att, const Tuple& v)
1779  {
1780  return ((ListTuple*)set_value(att, T_LIST_TUPLE, (void*)0, false)->get_pvalue())->add(v);
1781  }
1782  inline const Tuple& Tuple::get_tuple(const Symbol& att) const
1783  {
1784  return *(const Tuple*)get_pvalue(att, T_TUPLE, false);
1785  }
1786  inline const Tuple* Tuple::get_ptuple(const Symbol& att) const
1787  {
1788  if (Value* value = get_value(att, T_TUPLE))
1789  {
1790  return (const Tuple*)value->get_pvalue();
1791  }
1792  else
1793  {
1794  return 0;
1795  }
1796  }
1797  inline const ListTuple& Tuple::get_list_tuple(const Symbol& att) const
1798  {
1799  return *(const ListTuple*)get_pvalue(att, T_LIST_TUPLE, false);
1800  }
1801  inline const ListTuple* Tuple::get_plist_tuple(const Symbol& att) const
1802  {
1803  if (Value* value = get_value(att, T_LIST_TUPLE))
1804  {
1805  return (const ListTuple*)value->get_pvalue();
1806  }
1807  else
1808  {
1809  return 0;
1810  }
1811  };
1812 
1813  inline Blob& Tuple::set_blob(const Symbol& att, const Blob& v)
1814  {
1815  PValue value = set_value(att, T_BLOB, (void*)&v, false);
1816  return *(Blob*)value->get_pvalue();
1817  }
1818  inline Blob& Tuple::set_ref_blob(const Symbol& att, Blob& v)
1819  {
1820  set_value(att, T_BLOB, (void*)&v, true);
1821  return v;
1822  }
1823  inline const Blob& Tuple::set_cref_blob(const Symbol& att, const Blob& v)
1824  {
1825  set_value(att, T_BLOB, (const void*)&v, true, true);
1826  return v;
1827  }
1828  inline Blob& Tuple::set_blob(const Symbol& att)
1829  {
1830  PValue value = set_value(att, T_BLOB, 0, false);
1831  return *(Blob*)value->get_pvalue();
1832  }
1833  inline ListBlob& Tuple::set_list_blob(const Symbol& att, const ListBlob& v)
1834  {
1835  PValue value = set_value(att, T_LIST_BLOB, (void*)&v, false);
1836  return *(ListBlob*)value->get_pvalue();
1837  }
1838  inline ListBlob& Tuple::set_list_blob(const Symbol& att)
1839  {
1840  PValue value = set_value(att, T_LIST_BLOB, (void*)0, false);
1841  return *(ListBlob*)value->get_pvalue();
1842  }
1843  inline ListBlob& Tuple::set_ref_list_blob(const Symbol& att, ListBlob& v)
1844  {
1845  set_value(att, T_LIST_BLOB, (void*)&v, true);
1846  return v;
1847  }
1848  inline const ListBlob& Tuple::set_cref_list_blob(const Symbol& att, const ListBlob& v)
1849  {
1850  set_value(att, T_LIST_BLOB, (const void*)&v, true, true);
1851  return v;
1852  }
1853  inline Blob& Tuple::add_blob(const Symbol& att, const Blob& v)
1854  {
1855  return ((ListBlob*)set_value(att, T_LIST_BLOB, (void*)0, false)->get_pvalue())->add(v);
1856  }
1857  inline const Blob& Tuple::get_blob(const Symbol& att) const
1858  {
1859  return *(const Blob*)get_pvalue(att, T_BLOB, false);
1860  }
1861  inline const Blob* Tuple::get_pblob(const Symbol& att) const
1862  {
1863  if (Value* value = get_value(att, T_BLOB))
1864  {
1865  return (const Blob*)value->get_pvalue();
1866  }
1867  else
1868  {
1869  return 0;
1870  }
1871  }
1872  inline const ListBlob& Tuple::get_list_blob(const Symbol& att) const
1873  {
1874  return *(const ListBlob*)get_pvalue(att, T_LIST_BLOB, false);
1875  }
1876  inline const ListBlob* Tuple::get_plist_blob(const Symbol& att) const
1877  {
1878  if (Value* value = get_value(att, T_LIST_BLOB))
1879  {
1880  return (const ListBlob*)value->get_pvalue();
1881  }
1882  else
1883  {
1884  return 0;
1885  }
1886  };
1887 
1888  inline StringBuffer& Tuple::set_stringbuffer(const Symbol& att, const StringBuffer& v)
1889  {
1890  PValue value = set_value(att, T_STRING_BUFFER, (void*)&v, false);
1891  return *(StringBuffer*)value->get_pvalue();
1892  }
1893  inline StringBuffer& Tuple::set_ref_stringbuffer(const Symbol& att, StringBuffer& v)
1894  {
1895  set_value(att, T_STRING_BUFFER, (void*)&v, true);
1896  return v;
1897  }
1898  inline const StringBuffer& Tuple::set_cref_stringbuffer(const Symbol& att, const StringBuffer& v)
1899  {
1900  set_value(att, T_STRING_BUFFER, (const void*)&v, true, true);
1901  return v;
1902  }
1903  inline StringBuffer& Tuple::set_stringbuffer(const Symbol& att)
1904  {
1905  PValue value = set_value(att, T_STRING_BUFFER, 0, false);
1906  return *(StringBuffer*)value->get_pvalue();
1907  }
1908  inline ListStringBuffer& Tuple::set_list_stringbuffer(const Symbol& att, const ListStringBuffer& v)
1909  {
1910  PValue value = set_value(att, T_LIST_STRING_BUFFER, (void*)&v, false);
1911  return *(ListStringBuffer*)value->get_pvalue();
1912  }
1913  inline ListStringBuffer& Tuple::set_list_stringbuffer(const Symbol& att)
1914  {
1915  PValue value = set_value(att, T_LIST_STRING_BUFFER, (void*)0, false);
1916  return *(ListStringBuffer*)value->get_pvalue();
1917  }
1918  inline ListStringBuffer& Tuple::set_ref_list_stringbuffer(const Symbol& att, ListStringBuffer& v)
1919  {
1920  set_value(att, T_LIST_STRING_BUFFER, (void*)&v, true);
1921  return v;
1922  }
1923  inline const ListStringBuffer& Tuple::set_cref_list_stringbuffer(const Symbol& att, const ListStringBuffer& v)
1924  {
1925  set_value(att, T_LIST_STRING_BUFFER, (const void*)&v, true, true);
1926  return v;
1927  }
1928  inline StringBuffer& Tuple::add_stringbuffer(const Symbol& att, const StringBuffer& v)
1929  {
1930  return ((ListStringBuffer*)set_value(att, T_LIST_STRING_BUFFER, (void*)0, false)->get_pvalue())->add(v);
1931  }
1932  inline const StringBuffer& Tuple::get_stringbuffer(const Symbol& att) const
1933  {
1934  return *(const StringBuffer*)get_pvalue(att, T_STRING_BUFFER, false);
1935  }
1936  inline const StringBuffer* Tuple::get_pstringbuffer(const Symbol& att) const
1937  {
1938  if (Value* value = get_value(att, T_STRING_BUFFER))
1939  {
1940  return (const StringBuffer*)value->get_pvalue();
1941  }
1942  else
1943  {
1944  return 0;
1945  }
1946  }
1947  inline const ListStringBuffer& Tuple::get_list_stringbuffer(const Symbol& att) const
1948  {
1949  return *(const ListStringBuffer*)get_pvalue(att, T_LIST_STRING_BUFFER, false);
1950  }
1951  inline const ListStringBuffer* Tuple::get_plist_stringbuffer(const Symbol& att) const
1952  {
1953  if (Value* value = get_value(att, T_LIST_STRING_BUFFER))
1954  {
1955  return (const ListStringBuffer*)value->get_pvalue();
1956  }
1957  else
1958  {
1959  return 0;
1960  }
1961  };
1962 
1963  inline Symbol& Tuple::set_symbol(const Symbol& att, const Symbol& v)
1964  {
1965  PValue value = set_value(att, T_SYMBOL, (void*)&v, false);
1966  return *(Symbol*)value->get_pvalue();
1967  }
1968  inline Symbol& Tuple::set_ref_symbol(const Symbol& att, Symbol& v)
1969  {
1970  set_value(att, T_SYMBOL, (void*)&v, true);
1971  return v;
1972  }
1973  inline const Symbol& Tuple::set_cref_symbol(const Symbol& att, const Symbol& v)
1974  {
1975  set_value(att, T_SYMBOL, (const void*)&v, true, true);
1976  return v;
1977  }
1978  inline Symbol& Tuple::set_symbol(const Symbol& att)
1979  {
1980  PValue value = set_value(att, T_SYMBOL, 0, false);
1981  return *(Symbol*)value->get_pvalue();
1982  }
1983  inline ListSymbol& Tuple::set_list_symbol(const Symbol& att, const ListSymbol& v)
1984  {
1985  PValue value = set_value(att, T_LIST_SYMBOL, (void*)&v, false);
1986  return *(ListSymbol*)value->get_pvalue();
1987  }
1988  inline ListSymbol& Tuple::set_list_symbol(const Symbol& att)
1989  {
1990  PValue value = set_value(att, T_LIST_SYMBOL, (void*)0, false);
1991  return *(ListSymbol*)value->get_pvalue();
1992  }
1993  inline ListSymbol& Tuple::set_ref_list_symbol(const Symbol& att, ListSymbol& v)
1994  {
1995  set_value(att, T_LIST_SYMBOL, (void*)&v, true);
1996  return v;
1997  }
1998  inline const ListSymbol& Tuple::set_cref_list_symbol(const Symbol& att, const ListSymbol& v)
1999  {
2000  set_value(att, T_LIST_SYMBOL, (const void*)&v, true, true);
2001  return v;
2002  }
2003  inline Symbol& Tuple::add_symbol(const Symbol& att, const Symbol& v)
2004  {
2005  return ((ListSymbol*)set_value(att, T_LIST_SYMBOL, (void*)0, false)->get_pvalue())->add(v);
2006  }
2007  inline const Symbol& Tuple::get_symbol(const Symbol& att) const
2008  {
2009  return *(const Symbol*)get_pvalue(att, T_SYMBOL, false);
2010  }
2011  inline const Symbol* Tuple::get_psymbol(const Symbol& att) const
2012  {
2013  if (Value* value = get_value(att, T_SYMBOL))
2014  {
2015  return (const Symbol*)value->get_pvalue();
2016  }
2017  else
2018  {
2019  return 0;
2020  }
2021  }
2022  inline const ListSymbol& Tuple::get_list_symbol(const Symbol& att) const
2023  {
2024  return *(const ListSymbol*)get_pvalue(att, T_LIST_SYMBOL, false);
2025  }
2026  inline const ListSymbol* Tuple::get_plist_symbol(const Symbol& att) const
2027  {
2028  if (Value* value = get_value(att, T_LIST_SYMBOL))
2029  {
2030  return (const ListSymbol*)value->get_pvalue();
2031  }
2032  else
2033  {
2034  return 0;
2035  }
2036  };
2037 
2038  inline ArrayInt& Tuple::set_array_int(const Symbol& att, const ArrayInt& v)
2039  {
2040  PValue value = set_value(att, T_ARRAY_INT, (void*)&v, false);
2041  return *(ArrayInt*)value->get_pvalue();
2042  }
2043  inline ArrayInt& Tuple::set_ref_array_int(const Symbol& att, ArrayInt& v)
2044  {
2045  set_value(att, T_ARRAY_INT, (void*)&v, true);
2046  return v;
2047  }
2048  inline const ArrayInt& Tuple::set_cref_array_int(const Symbol& att, const ArrayInt& v)
2049  {
2050  set_value(att, T_ARRAY_INT, (const void*)&v, true, true);
2051  return v;
2052  }
2053  inline ArrayInt& Tuple::set_array_int(const Symbol& att)
2054  {
2055  PValue value = set_value(att, T_ARRAY_INT, 0, false);
2056  return *(ArrayInt*)value->get_pvalue();
2057  }
2058  inline ListArrayInt& Tuple::set_list_array_int(const Symbol& att, const ListArrayInt& v)
2059  {
2060  PValue value = set_value(att, T_LIST_ARRAY_INT, (void*)&v, false);
2061  return *(ListArrayInt*)value->get_pvalue();
2062  }
2063  inline ListArrayInt& Tuple::set_list_array_int(const Symbol& att)
2064  {
2065  PValue value = set_value(att, T_LIST_ARRAY_INT, (void*)0, false);
2066  return *(ListArrayInt*)value->get_pvalue();
2067  }
2068  inline ListArrayInt& Tuple::set_ref_list_array_int(const Symbol& att, ListArrayInt& v)
2069  {
2070  set_value(att, T_LIST_ARRAY_INT, (void*)&v, true);
2071  return v;
2072  }
2073  inline const ListArrayInt& Tuple::set_cref_list_array_int(const Symbol& att, const ListArrayInt& v)
2074  {
2075  set_value(att, T_LIST_ARRAY_INT, (const void*)&v, true, true);
2076  return v;
2077  }
2078  inline ArrayInt& Tuple::add_array_int(const Symbol& att, const ArrayInt& v)
2079  {
2080  return ((ListArrayInt*)set_value(att, T_LIST_ARRAY_INT, (void*)0, false)->get_pvalue())->add(v);
2081  }
2082  inline const ArrayInt& Tuple::get_array_int(const Symbol& att) const
2083  {
2084  return *(const ArrayInt*)get_pvalue(att, T_ARRAY_INT, false);
2085  }
2086  inline const ArrayInt* Tuple::get_parray_int(const Symbol& att) const
2087  {
2088  if (Value* value = get_value(att, T_ARRAY_INT))
2089  {
2090  return (const ArrayInt*)value->get_pvalue();
2091  }
2092  else
2093  {
2094  return 0;
2095  }
2096  }
2097  inline const ListArrayInt& Tuple::get_list_array_int(const Symbol& att) const
2098  {
2099  return *(const ListArrayInt*)get_pvalue(att, T_LIST_ARRAY_INT, false);
2100  }
2101  inline const ListArrayInt* Tuple::get_plist_array_int(const Symbol& att) const
2102  {
2103  if (Value* value = get_value(att, T_LIST_ARRAY_INT))
2104  {
2105  return (const ListArrayInt*)value->get_pvalue();
2106  }
2107  else
2108  {
2109  return 0;
2110  }
2111  };
2112 
2113  inline ArrayLong& Tuple::set_array_long(const Symbol& att, const ArrayLong& v)
2114  {
2115  PValue value = set_value(att, T_ARRAY_LONG, (void*)&v, false);
2116  return *(ArrayLong*)value->get_pvalue();
2117  }
2118  inline ArrayLong& Tuple::set_ref_array_long(const Symbol& att, ArrayLong& v)
2119  {
2120  set_value(att, T_ARRAY_LONG, (void*)&v, true);
2121  return v;
2122  }
2123  inline const ArrayLong& Tuple::set_cref_array_long(const Symbol& att, const ArrayLong& v)
2124  {
2125  set_value(att, T_ARRAY_LONG, (const void*)&v, true, true);
2126  return v;
2127  }
2128  inline ArrayLong& Tuple::set_array_long(const Symbol& att)
2129  {
2130  PValue value = set_value(att, T_ARRAY_LONG, 0, false);
2131  return *(ArrayLong*)value->get_pvalue();
2132  }
2133  inline ListArrayLong& Tuple::set_list_array_long(const Symbol& att, const ListArrayLong& v)
2134  {
2135  PValue value = set_value(att, T_LIST_ARRAY_LONG, (void*)&v, false);
2136  return *(ListArrayLong*)value->get_pvalue();
2137  }
2138  inline ListArrayLong& Tuple::set_list_array_long(const Symbol& att)
2139  {
2140  PValue value = set_value(att, T_LIST_ARRAY_LONG, (void*)0, false);
2141  return *(ListArrayLong*)value->get_pvalue();
2142  }
2143  inline ListArrayLong& Tuple::set_ref_list_array_long(const Symbol& att, ListArrayLong& v)
2144  {
2145  set_value(att, T_LIST_ARRAY_LONG, (void*)&v, true);
2146  return v;
2147  }
2148  inline const ListArrayLong& Tuple::set_cref_list_array_long(const Symbol& att, const ListArrayLong& v)
2149  {
2150  set_value(att, T_LIST_ARRAY_LONG, (const void*)&v, true, true);
2151  return v;
2152  }
2153  inline ArrayLong& Tuple::add_array_long(const Symbol& att, const ArrayLong& v)
2154  {
2155  return ((ListArrayLong*)set_value(att, T_LIST_ARRAY_LONG, (void*)0, false)->get_pvalue())->add(v);
2156  }
2157  inline const ArrayLong& Tuple::get_array_long(const Symbol& att) const
2158  {
2159  return *(const ArrayLong*)get_pvalue(att, T_ARRAY_LONG, false);
2160  }
2161  inline const ArrayLong* Tuple::get_parray_long(const Symbol& att) const
2162  {
2163  if (Value* value = get_value(att, T_ARRAY_LONG))
2164  {
2165  return (const ArrayLong*)value->get_pvalue();
2166  }
2167  else
2168  {
2169  return 0;
2170  }
2171  }
2172  inline const ListArrayLong& Tuple::get_list_array_long(const Symbol& att) const
2173  {
2174  return *(const ListArrayLong*)get_pvalue(att, T_LIST_ARRAY_LONG, false);
2175  }
2176  inline const ListArrayLong* Tuple::get_plist_array_long(const Symbol& att) const
2177  {
2178  if (Value* value = get_value(att, T_LIST_ARRAY_LONG))
2179  {
2180  return (const ListArrayLong*)value->get_pvalue();
2181  }
2182  else
2183  {
2184  return 0;
2185  }
2186  };
2187 
2188  inline ArrayFloat& Tuple::set_array_float(const Symbol& att, const ArrayFloat& v)
2189  {
2190  PValue value = set_value(att, T_ARRAY_FLOAT, (void*)&v, false);
2191  return *(ArrayFloat*)value->get_pvalue();
2192  }
2193  inline ArrayFloat& Tuple::set_ref_array_float(const Symbol& att, ArrayFloat& v)
2194  {
2195  set_value(att, T_ARRAY_FLOAT, (void*)&v, true);
2196  return v;
2197  }
2198  inline const ArrayFloat& Tuple::set_cref_array_float(const Symbol& att, const ArrayFloat& v)
2199  {
2200  set_value(att, T_ARRAY_FLOAT, (const void*)&v, true, true);
2201  return v;
2202  }
2203  inline ArrayFloat& Tuple::set_array_float(const Symbol& att)
2204  {
2205  PValue value = set_value(att, T_ARRAY_FLOAT, 0, false);
2206  return *(ArrayFloat*)value->get_pvalue();
2207  }
2208  inline ListArrayFloat& Tuple::set_list_array_float(const Symbol& att, const ListArrayFloat& v)
2209  {
2210  PValue value = set_value(att, T_LIST_ARRAY_FLOAT, (void*)&v, false);
2211  return *(ListArrayFloat*)value->get_pvalue();
2212  }
2213  inline ListArrayFloat& Tuple::set_list_array_float(const Symbol& att)
2214  {
2215  PValue value = set_value(att, T_LIST_ARRAY_FLOAT, (void*)0, false);
2216  return *(ListArrayFloat*)value->get_pvalue();
2217  }
2218  inline ListArrayFloat& Tuple::set_ref_list_array_float(const Symbol& att, ListArrayFloat& v)
2219  {
2220  set_value(att, T_LIST_ARRAY_FLOAT, (void*)&v, true);
2221  return v;
2222  }
2223  inline const ListArrayFloat& Tuple::set_cref_list_array_float(const Symbol& att, const ListArrayFloat& v)
2224  {
2225  set_value(att, T_LIST_ARRAY_FLOAT, (const void*)&v, true, true);
2226  return v;
2227  }
2228  inline ArrayFloat& Tuple::add_array_float(const Symbol& att, const ArrayFloat& v)
2229  {
2230  return ((ListArrayFloat*)set_value(att, T_LIST_ARRAY_FLOAT, (void*)0, false)->get_pvalue())->add(v);
2231  }
2232  inline const ArrayFloat& Tuple::get_array_float(const Symbol& att) const
2233  {
2234  return *(const ArrayFloat*)get_pvalue(att, T_ARRAY_FLOAT, false);
2235  }
2236  inline const ArrayFloat* Tuple::get_parray_float(const Symbol& att) const
2237  {
2238  if (Value* value = get_value(att, T_ARRAY_FLOAT))
2239  {
2240  return (const ArrayFloat*)value->get_pvalue();
2241  }
2242  else
2243  {
2244  return 0;
2245  }
2246  }
2247  inline const ListArrayFloat& Tuple::get_list_array_float(const Symbol& att) const
2248  {
2249  return *(const ListArrayFloat*)get_pvalue(att, T_LIST_ARRAY_FLOAT, false);
2250  }
2251  inline const ListArrayFloat* Tuple::get_plist_array_float(const Symbol& att) const
2252  {
2253  if (Value* value = get_value(att, T_LIST_ARRAY_FLOAT))
2254  {
2255  return (const ListArrayFloat*)value->get_pvalue();
2256  }
2257  else
2258  {
2259  return 0;
2260  }
2261  };
2262 
2263  inline ArrayDouble& Tuple::set_array_double(const Symbol& att, const ArrayDouble& v)
2264  {
2265  PValue value = set_value(att, T_ARRAY_DOUBLE, (void*)&v, false);
2266  return *(ArrayDouble*)value->get_pvalue();
2267  }
2268  inline ArrayDouble& Tuple::set_ref_array_double(const Symbol& att, ArrayDouble& v)
2269  {
2270  set_value(att, T_ARRAY_DOUBLE, (void*)&v, true);
2271  return v;
2272  }
2273  inline const ArrayDouble& Tuple::set_cref_array_double(const Symbol& att, const ArrayDouble& v)
2274  {
2275  set_value(att, T_ARRAY_DOUBLE, (const void*)&v, true, true);
2276  return v;
2277  }
2278  inline ArrayDouble& Tuple::set_array_double(const Symbol& att)
2279  {
2280  PValue value = set_value(att, T_ARRAY_DOUBLE, 0, false);
2281  return *(ArrayDouble*)value->get_pvalue();
2282  }
2283  inline ListArrayDouble& Tuple::set_list_array_double(const Symbol& att, const ListArrayDouble& v)
2284  {
2285  PValue value = set_value(att, T_LIST_ARRAY_DOUBLE, (void*)&v, false);
2286  return *(ListArrayDouble*)value->get_pvalue();
2287  }
2288  inline ListArrayDouble& Tuple::set_list_array_double(const Symbol& att)
2289  {
2290  PValue value = set_value(att, T_LIST_ARRAY_DOUBLE, (void*)0, false);
2291  return *(ListArrayDouble*)value->get_pvalue();
2292  }
2293  inline ListArrayDouble& Tuple::set_ref_list_array_double(const Symbol& att, ListArrayDouble& v)
2294  {
2295  set_value(att, T_LIST_ARRAY_DOUBLE, (void*)&v, true);
2296  return v;
2297  }
2298  inline const ListArrayDouble& Tuple::set_cref_list_array_double(const Symbol& att, const ListArrayDouble& v)
2299  {
2300  set_value(att, T_LIST_ARRAY_DOUBLE, (const void*)&v, true, true);
2301  return v;
2302  }
2303  inline ArrayDouble& Tuple::add_array_double(const Symbol& att, const ArrayDouble& v)
2304  {
2305  return ((ListArrayDouble*)set_value(att, T_LIST_ARRAY_DOUBLE, (void*)0, false)->get_pvalue())->add(v);
2306  }
2307  inline const ArrayDouble& Tuple::get_array_double(const Symbol& att) const
2308  {
2309  return *(const ArrayDouble*)get_pvalue(att, T_ARRAY_DOUBLE, false);
2310  }
2311  inline const ArrayDouble* Tuple::get_parray_double(const Symbol& att) const
2312  {
2313  if (Value* value = get_value(att, T_ARRAY_DOUBLE))
2314  {
2315  return (const ArrayDouble*)value->get_pvalue();
2316  }
2317  else
2318  {
2319  return 0;
2320  }
2321  }
2322  inline const ListArrayDouble& Tuple::get_list_array_double(const Symbol& att) const
2323  {
2324  return *(const ListArrayDouble*)get_pvalue(att, T_LIST_ARRAY_DOUBLE, false);
2325  }
2326  inline const ListArrayDouble* Tuple::get_plist_array_double(const Symbol& att) const
2327  {
2328  if (Value* value = get_value(att, T_LIST_ARRAY_DOUBLE))
2329  {
2330  return (const ListArrayDouble*)value->get_pvalue();
2331  }
2332  else
2333  {
2334  return 0;
2335  }
2336  };
2337 
2338 
2339 
2340  inline AString& commore::Tuple::set_astring(const Symbol& att, const AChar* v)
2341  {
2342  PValue value = set_value(att, T_ASTRING, (void*)0, false);
2343  AString& r = *(AString*)value->get_pvalue();
2344  if (v)
2345  {
2346  r = v;
2347  }
2348  return r;
2349  }
2350 
2351 
2352  inline String& Tuple::set_string(const Symbol& att, const Char* v)
2353  {
2354  PValue value = set_value(att, T_STRING, (void*)0, false);
2355  String& r = *(String*)value->get_pvalue();
2356  if (v)
2357  {
2358  r = v;
2359  }
2360  return r;
2361  }
2362 
2363 
2364  inline StringBuffer& Tuple::set_stringbuffer(const Symbol& att, const AChar* v)
2365  {
2366  PValue value = set_value(att, T_STRING_BUFFER, (void*)0, false);
2367  StringBuffer& r = *(StringBuffer*)value->get_pvalue();
2368  if (v)
2369  {
2370  r = v;
2371  }
2372  return r;
2373  }
2374 
2375  inline StringBuffer& Tuple::add_stringbuffer(const Symbol& att, const AChar* v)
2376  {
2377  PValue value = set_value(att, T_LIST_STRING_BUFFER, (void*)0, false);
2378  ListStringBuffer& l = *(ListStringBuffer*)value->get_pvalue();
2379  if (v)
2380  {
2381  return l.add(v);
2382  }
2383  else
2384  {
2385  return l.add();
2386  }
2387  }
2388 
2389 
2390  inline AString& Tuple::add_astring(const Symbol& att, const AChar* v)
2391  {
2392  ListAString& l = set_list_astring(att);
2393  return *l.insert(l.end(), v);
2394  }
2395 
2396 
2397  inline String& Tuple::add_string(const Symbol& att, const Char* v)
2398  {
2399  ListString& l = set_list_string(att);
2400  return *l.insert(l.end(), v == 0 ? L"" : v);
2401  }
2402 
2403 
2404 
2405 };
2406 
2407 inline commore::OBStream& operator << (commore::OBStream& o, const commore::Tuple& tuple)
2408 {
2409  tuple.write_xml(o);
2410  return o;
2411 }
2412 
2413 #endif
2414 
const Symbol & get_class_name() const
Definition: Tuple.h:643
String & set_string(const Symbol &att, const Char *v)
Definition: Tuple.h:2352
StringBuffer & set_stringbuffer(const Symbol &att, const AChar *v)
Definition: Tuple.h:2364
ValueIterator & operator++()
Definition: Tuple.h:414
Definition: Tuple.h:29
Definition: AString.h:39
Definition: Time.h:21
StringBuffer & add_stringbuffer(const Symbol &att, const AChar *v)
Definition: Tuple.h:2375
AString & set_astring(const Symbol &att, const AChar *v)
Definition: Tuple.h:2340
Definition: List.h:23
Definition: Blob.h:18
Definition: StringBuffer.h:21
AString & add_astring(const Symbol &att, const AChar *v=0)
Definition: Tuple.h:2390
Definition: Symbol.h:18
Definition: Tuple.h:437
String & add_string(const Symbol &att, const Char *v=0)
Definition: Tuple.h:2397
iterator insert(iterator pos, const T &value)
Definition: List.h:233
const Symbol & get_symbol(const Symbol &att) const
Definition: Tuple.h:2007
bool is_a(Symbol class_name) const
Definition: Tuple.h:546
Definition: Tuple.h:37
Definition: Path.h:19
Definition: String.h:40
T & add()
Definition: List.h:319
Definition: Tuple.h:383
Definition: CommBuffer.h:28
Definition: Array.h:21
const void * get_pvalue() const
long write_xml(OBStream &o, const AChar *att=0) const
ConstValueIterator & operator++()
Definition: Tuple.h:467
ValueIterator operator++(int)
Definition: Tuple.h:419
iterator end()
Definition: List.h:160
Definition: IOBStream.h:166
ConstValueIterator operator++(int)
Definition: Tuple.h:472
Definition: IOBStream.h:29
Definition: Time.h:261
Types
Definition: Type.h:131