/* * Rick Ratzel * 3/11/2004 * * Copyright (c) 2004 Richard L. Ratzel * see file "COPYRIGHT" for more details... */ #include using namespace std; // // Exception thrown by all CF objs // class CFException { public : CFException( const char* val ); const char* getVal() const; private : const char* d_val; }; ostream& operator<<( ostream& ostr, const CFException& cfe ); // // CFObj is a C++-usable version of a Python type // class CFObj { public : enum CFObjType {CFUNKNOWN, CFINT, CFSTRING, CFFLOAT, CFDOUBLE, CFLIST, CFMAP}; CFObj( int id ); CFObj( const CFObj& cfo ); ~CFObj(); int id() const; CFObjType type() const; int getInt() const; char* getString() const; float getFloat() const; double getDouble() const; int length() const; CFObj keys() const; CFObj operator[]( const CFObj& k ) const; CFObj operator[]( int k ) const; CFObj operator[]( float k ) const; CFObj operator[]( double k ) const; CFObj operator[]( char* k ) const; private : int d_id; CFObjType d_type; }; ostream& operator<<( ostream& ostr, const CFObj& cfo ); // // configfile is a C++-usable version of the configfile class in Python // ...actual calls to Python are made possible with Elmer-generated calls // class configfile { public : configfile( char* fileName ); configfile( const configfile& cf ); ~configfile(); const char* getFileName(); CFObj getVars(); CFObj getValue( char* val ); CFObj getValue( const CFObj& val ); private : int d_id; void assertInitialized(); };