casa  $Rev:20696$
record.h
Go to the documentation of this file.
00001 #ifndef __casac_record_h__
00002 #define __casac_record_h__
00003 
00004 #include <map>
00005 #include <string>
00006 #include <xmlcasa/variant.h>
00007 
00008 namespace casac {
00009 
00010 typedef std::map<std::string,variant> rec_map;
00011 
00012 // todo:        o create python to/from record functions
00013 //              o implement compare()
00014 //              o implement record_to_string()
00015 //              o create a thorough test program
00016 //              o verify that std::map<>'s copy ctor does a complete copy
00017 //              o add copy-on-write (w/ reference counting)
00018 //
00019 class record : public  rec_map {
00020     public:
00021         typedef rec_map::iterator iterator;
00022         typedef rec_map::const_iterator const_iterator;
00023         typedef rec_map::value_type value_type;
00024 
00025         record();
00026         record *clone() const { return new record(*this); }
00027         int compare(const record*) const;
00028 
00029         record( const record &r ) : rec_map(r) { }
00030         record &operator=(const record &r) { rec_map::operator=(r); return *this; }
00031         std::pair<rec_map::iterator,bool> insert(const std::string &s,const variant &v);
00032 };
00033 
00034 }       // casac namespace
00035 
00036 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines