📄 machinedatabase.h
字号:
// file: $isip/class/asr/MachineDatabase/MachineDatabase.h// version: $Id: MachineDatabase.h,v 1.5 2002/08/13 23:27:47 alphonso Exp $//// make sure definitions are only made once//#ifndef ISIP_MACHINE_DATABASE#define ISIP_MACHINE_DATABASE#ifndef ISIP_STRING#include <String.h>#endif#ifndef ISIP_VECTOR#include <Vector.h>#endif#ifndef ISIP_MACHINE#include <Machine.h>#endif// forward class definitions//class Machine;// MachineDatabase: a class used to represent a database of machines//class MachineDatabase { //-------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // other important constants // //---------------------------------------- //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; static const String PARAM_NAME; static const String PARAM_MACHINES; //---------------------------------------- // // default values and arguments // //---------------------------------------- // default values // //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // define the database name // String name_d; // define the container object // Vector<Machine> database_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 boolean diagnose(Integral::DEBUG debug_level); // debug methods // boolean debug(const unichar* msg) const; // method: setDebug // static boolean setDebug(Integral::DEBUG arg) { debug_level_d = arg; return true; } // method: destructor // ~MachineDatabase() { clear(); } // method: default constructor // MachineDatabase(); // method: copy constructor // MachineDatabase(const MachineDatabase& arg) { assign(arg); } // method: assign // boolean assign(const MachineDatabase& arg); // method: sofSize // long sofSize() const { return (name_d.sofSize() + database_d.sofSize()); } // method: read // boolean read(Sof& sof, long tag) { return read(sof, tag, name()); } // other read methods // boolean read(Sof& sof, long tag, const String& name); boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false); // method: write // boolean write(Sof& sof, long tag) const { return write(sof, tag, name()); } // other write methods // boolean write(Sof& sof, long tag, const String& name) const; boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const; // method: eq // boolean eq(const MachineDatabase& 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 boolean setGrowSize(long arg) { return mgr_d.setGrow(arg); } // method: clear // boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods // //--------------------------------------------------------------------------- // method: isEmpty // boolean isEmpty() { return ((long)database_d.length() == 0); } // method: getDataBaseName // String& getDataBaseName() { return name_d; } // method: setDataBaseName // boolean setDataBaseName(String& arg) { return name_d.assign(arg); } // method: getDataBase // Vector<Machine>& getDataBase() { return database_d; } // method: setDataBase // boolean setDataBase(Vector<Machine>& arg) { return database_d.assign(arg); } // method: get // boolean get(String& node, Machine& machine) { for (long i=0; i < database_d.length(); i++) { if (database_d(i).getNodeName().eq(node)) { machine.assign(database_d(i)); return true; } } return false; } //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private:};//end of include file//#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -