00001 #ifndef CDBBDBTABLE_NTUPLE_P_HH 00002 #define CDBBDBTABLE_NTUPLE_P_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbNTupleP.ddl,v 1.3 2004/03/26 02:45:41 gapon Exp $ 00006 00007 #include "CdbBdbTable/CdbBdbNTupleBaseP.hh" 00008 00009 /// An abstract base class for persistent n-tuples 00010 /** 00011 * This class adds a type safe interface of the n-tuple model by prividing 00012 * a set of virtual methods to access or modify the contents of a tuple. 00013 * 00014 * RESTRICTIONS: 00015 * 00016 * (1) Rows are numbered beginning from 0. 00017 * 00018 * (2) In all operations with rows, a row is defined through a STD vector 00019 * of element type. The number of elements in the vector must be exactly 00020 * the number of columns passed to the constructor. 00021 */ 00022 template< class E > 00023 class CdbBdbNTupleP : public CdbBdbNTupleBaseP { 00024 00025 public: 00026 00027 typedef E ElementType; 00028 00029 private: 00030 00031 /// Default constructor (IS NOT IMPLEMENTED) 00032 00033 CdbBdbNTupleP( ); 00034 00035 /// Copy constructor (IS NOT IMPLEMENTED) 00036 00037 CdbBdbNTupleP( const CdbBdbNTupleP<E>& ); 00038 00039 /// Assignment operator (IS NOT IMPLEMENTED) 00040 00041 CdbBdbNTupleP<E>& operator=( const CdbBdbNTupleP<E>& ); 00042 00043 protected: 00044 00045 /// Constructor 00046 /** 00047 * @see CdbBdbNTupleBaseP::CdbBdbNTupleBaseP() 00048 */ 00049 CdbBdbNTupleP( d_ULong theNumberOfColumns, 00050 const std::string& theName, 00051 const std::string& theDescription, 00052 const std::vector<std::string>& theColumnNames ) : 00053 CdbBdbNTupleBaseP( theNumberOfColumns, 00054 theName, 00055 theDescription, 00056 theColumnNames ) 00057 {} 00058 00059 public: 00060 00061 /// Get the number of rows in the tuple 00062 00063 virtual d_ULong rows( ) const = 0; 00064 00065 /// Get a row at a specified position 00066 /** 00067 * This method has to be implemented by a subclass. 00068 * 00069 * @return the completion status of the operation 00070 * 00071 * Returned status values: 00072 * 00073 * CdbStatus::Success - successfull completion. The vector passed as a parameter 00074 * will be filled exactly the same number of elements as 00075 * the number of columns in the tuple. 00076 * 00077 * CdbStatus::NotFound - a row with specified number is not found. The vector passed 00078 * as a parameter won't be modified. 00079 * 00080 * CdbStatus::* - any other problem occured preventing the successfull completion 00081 * of the operation. The vector passed as a parameter won't be modified. 00082 * 00083 * Also see the RESTRICTIONS section at the defintion of the class for more 00084 * detailed information on values of parameters. 00085 * 00086 */ 00087 virtual CdbStatus get_row( std::vector<ElementType>& theRow, 00088 const d_ULong theNumber ) const = 0; 00089 00090 /// Append a row by the end of an existing list 00091 /** 00092 * This method has to be implemented by a subclass. 00093 * 00094 * @return the completion status of the operation 00095 * 00096 * Returned status values: 00097 * 00098 * CdbStatus::Success - successfull completion. The vector passed as a parameter 00099 * will be filled exactly the same number of elements as 00100 * the number of columns in the tuple. 00101 * 00102 * CdbStatus::IllegalParameters - an incomplete row with wrong number of elements passed 00103 * to the method. The number of elements must match 00104 * the number of columns. 00105 * 00106 * CdbStatus::* - any other problem occured preventing the successfull completion 00107 * of the operation. The vector passed as a parameter won't be modified. 00108 * 00109 * Also see the RESTRICTIONS section at the defintion of the class for more 00110 * detailed information on values of parameters. 00111 */ 00112 virtual CdbStatus append_row( const std::vector<ElementType>& theRow ) = 0; 00113 00114 /// Repack the internal storage of the tuple 00115 /** 00116 * This operation is meant to optimize the use of the internal storage of 00117 * the tuple by making the storage size equal to the actual number of elements 00118 * stored in the tuple. 00119 * 00120 * @return the completion status of the operation 00121 */ 00122 virtual CdbStatus repack( ) = 0; 00123 }; 00124 00125 #endif /* CDBBDBTABLE_NTUPLE_P_HH */
1.3-rc3