home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / OOFILE headers / oofctree.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-14  |  2.0 KB  |  85 lines  |  [TEXT/CWIE]

  1. #ifndef H_OOFctree
  2. #define H_OOFctree
  3.  
  4. // OOFILE c-tree Plus backend implementation
  5. // EXPORTED header - this is the one included in client programs
  6.  
  7. #include "oof1.hpp"
  8. #include "oof3.hpp"   // non-numeric fields
  9. #include "oof4.hpp"   // numeric fields
  10.  
  11. #ifdef __CW55__     
  12. // conflicts with defs in string.h if extern "C" these
  13.     #include "ctstdr.h"
  14.     #include "ctifil.h"
  15. #else
  16. extern "C" {
  17.     #include "ctstdr.h"
  18.     #include "ctifil.h"
  19. }
  20. #endif
  21.  
  22. #include "oofoptn.hpp"
  23.  
  24.  
  25. class dbConnect_ctree : public dbConnect {
  26. public:
  27.     enum eLockingStates    {noLocking, readLocking, writeLocking};
  28.  
  29.     dbConnect_ctree() :
  30.                                     mHasBlobs(false),
  31.                                     mUseSuperfile(true),
  32.                                     mLockingState(noLocking),
  33.                                     mReadLockApplications(0),
  34.                                     mWriteLockApplications(0)
  35.     { 
  36.     };
  37.     
  38.     virtual ~dbConnect_ctree();
  39.     
  40.     virtual void newConnection(const OOF_String& connectionName);
  41.     virtual void openConnection(const OOF_String& connectionName);
  42.     
  43.     // special settings specific to this concrete connection
  44.     void useSeparateFiles();
  45.     
  46.     bool isReadLocked() const;
  47.     bool isWriteLocked() const;
  48.     
  49. // interchange with OOF_tableBackend_ctree
  50.     void blobsHaveBeenFound();
  51.     COUNT allocBlobFilNo();
  52.     
  53. // locking
  54.     virtual void exitLocking();
  55.     virtual void enterWriteLocking();
  56.     virtual void enterReadLocking();
  57.  
  58.     // utility
  59.     OOF_String makeTableName(const char*) const;
  60.  
  61. private:
  62.     void SetLockingStyle(eLockingStates);
  63.     virtual OOF_tableBackend *MakeTableBackend(const OOF_Dictionary& tablesfields, const OOF_String& tableName);
  64.     virtual void SetupConnection(const OOF_String& connectionName);
  65.     void OpenMySpecialTables(const OOF_String& connectionName);
  66.     void CreateMySpecialTables(const OOF_String& connectionName);
  67.     
  68.  
  69.     
  70. // data storage
  71.     bool    mHasBlobs, mUseSuperfile;
  72.     eLockingStates mLockingState;
  73.     int mReadLockApplications, mWriteLockApplications;
  74.     COUNT mSuperFilNo, mBlobFilNo;
  75.     
  76. public:
  77.     static COUNT sFileMode;
  78. };
  79. ostream& operator<<(ostream& os, dbConnect_ctree& connect);
  80.  
  81.  
  82. // include inline definitions
  83. #include "oofctree.inl"
  84.  
  85. #endif