// file: $isip/class/asr/AudioDatabase/AudioDatabase.h // version: $Id: AudioDatabase.h 9420 2004-03-10 20:09:46Z parihar $ // // make sure definitions are only made once // #ifndef ISIP_AUDIO_DATABASE #define ISIP_AUDIO_DATABASE #ifndef ISIP_STRING #include #endif #ifndef ISIP_FILENAME #include #endif #ifndef ISIP_HASH_TABLE #include #endif #ifndef ISIP_SDB #include #endif // AudioDatabase: a class that facilitates the interface between the audio // database and another application or class // class AudioDatabase { //-------------------------------------------------------------------------- // // public constants // //-------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; // i/o related constants // static const String DEF_PARAM; static const String PARAM_KEYS; static const String PARAM_NAME; static const String PARAM_VALUES; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // define the database name // String name_d; // define the container object // HashTable hash_d; // define the database file // Sof database_sof_d; // declare a static debug level for all class instantiations // static Integral::DEBUG debug_level_d; // a static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } static bool8 diagnose(Integral::DEBUG debug_level); // debug methods // bool8 debug(const unichar* msg) const; // method: setDebug // static bool8 setDebug(Integral::DEBUG arg) { debug_level_d = arg; return true; } // method: destructor // ~AudioDatabase() {} // method: default constructor // AudioDatabase(); // method: copy constructor // AudioDatabase(const AudioDatabase& arg) { assign(arg); } // method: assign // bool8 assign(const AudioDatabase& arg); // method: sofSize // int32 sofSize() const; // method: read // bool8 read(Sof& sof, int32 tag) { return read(sof, tag, name()); } bool8 read(Sof& sof, int32 tag, const String& name); bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false); // method: write // bool8 write(Sof& sof, int32 tag) const { return write(sof, tag, name()); } bool8 write(Sof& sof, int32 tag, const String& name) const; bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const; // method: eq // bool8 eq(const AudioDatabase& arg) const; // method: new // static void* operator new(size_t arg) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t arg) { return mgr_d.getBlock(arg); } // method: delete // static void operator delete(void* arg) { mgr_d.release(arg); } // method: delete[] // static void operator delete[](void* arg) { mgr_d.releaseBlock(arg); } // method: setGrowSize // static bool8 setGrowSize(int32 arg) { return mgr_d.setGrow(arg); } // method: clear // bool8 clear(Integral::CMODE cmode = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: getDataBaseName // String& getDataBaseName() { return name_d; } // method: setDataBaseName // bool8 setDataBaseName(String& arg) { return name_d.assign(arg); } // method: getSymbolTable // HashTable& getSymbolTable() { return hash_d; } // method to retrieve a record form the database // bool8 getRecord(String& identifier, Filename& record); // method: removeRecord // bool8 removeRecord(String& identifier) { return hash_d.remove(identifier); } // method: insertRecord // bool8 insertRecord(String& identifier, Long& index) { return hash_d.insert(identifier, &index); } // database open and close method // bool8 open(const Filename& db_sof); bool8 close(); // method: load // bool8 load(Sdb& id_list, Sdb& file_list, Vector& file_vec); // method: load // bool8 load(Filename& file_list, Vector& file_vec); // method: store // bool8 store(Sof& db_sof, int32 tag, Vector& file_vec); //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; //end of include file // #endif