1#ifndef INC_GLOTALLSET_H
2#define INC_GLOTALLSET_H
42#include "GloObjectMaker.h"
315 int get( T *& prRetVal, EnSeekMode eMode );
352 int get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode );
449 int get(
glo::ObjID & rObjID, std::shared_ptr<T> & rRetVal, EnSeekMode eMode );
682 const std::string & rsIndexSearchValue,
683 EnQueryType eQuerryType );
724 const std::string & rsFullIndexName,
725 const std::string & rsIndexSearchValue,
726 EnQueryType eQuerryType );
772 const std::string & rsIndexName,
773 unsigned long ulIndexClassID,
774 const std::string & rsIndexSearchValue,
775 EnQueryType eQuerryType );
818 const std::string & rsIndexSearchValue,
819 EnComparisionOp eComparisionOp );
867 const std::string & rsFullIndexName,
868 const std::string & rsIndexSearchValue,
869 EnComparisionOp eComparisionOp );
922 const std::string & rsIndexName,
923 unsigned long ulIndexClassID,
924 const std::string & rsIndexSearchValue,
925 EnComparisionOp eComparisionOp );
960 const std::string & rsRangeStartIndex,
961 const std::string & rsRangeEndIndex );
1004 const std::string & rsFullIndexName,
1005 const std::string & rsRangeStartIndexSearchValue,
1006 const std::string & rsRangeEndIndexSearchValue );
1055 const std::string & rsIndexName,
1056 unsigned long ulIndexClassID,
1057 const std::string & rsRangeStartIndexSearchValue,
1058 const std::string & rsRangeEndIndexSearchValue );
1205 #define SUPER BaseAllSet
1207 template <
class T >
1214 std::shared_ptr<T> t_TempT(
new T, Forgeter<T>() );
1215 SUPER::setClassIDFromTemplate( t_TempT->getGloClassID() );
1218 template <
class T >
1220 :
SUPER( rBase, 0, bWithSubClasses )
1225 std::shared_ptr<T> t_TempT(
new T, Forgeter<T>() );
1226 SUPER::setClassIDFromTemplate( t_TempT->getGloClassID() );
1229 template <
class T >
1236 std::shared_ptr<T> t_TempT(
new T, Forgeter<T>() );
1237 SUPER::setClassIDFromTemplate( t_TempT->getGloClassID() );
1238 int t_iErr = SUPER::setFullIndexName( rsFullIndexName );
1241 throw eut::ErrorNException(
"TAllSet::setBase(Base * pBase, unsigned long ulClassID, const std::string & rsFullIndexName)", t_iErr, __FILE__, __LINE__ );
1245 template <
class T >
1250 template <
class T >
1254 return this->get( t_TempObjID, prRetVal, eMode );
1257 template <
class T >
1261 return this->get( t_TempObjID, rRetVal, eMode );
1264 template <
class T >
1270 t_iErr = this->open();
1275 t_iErr = this->getBase()->getObjectFromAllSet( rObjID, t_pGetObj, *
this, eMode );
1280 prRetVal =
dynamic_cast<T*
>( t_pGetObj );
1285 if ( eMode == glo::START || eMode == glo::NEXT )
1287 t_iErr = this->getBase()->getObjectFromAllSet( rObjID, t_pGetObj, *
this, glo::NEXT );
1289 else if ( eMode == glo::END || eMode == glo::PREVIOUS )
1291 t_iErr = this->getBase()->getObjectFromAllSet( rObjID, t_pGetObj, *
this, glo::PREVIOUS );
1298 }
while ( ! t_iErr );
1304 template <
class T >
1309 T * t_pPersistent = 0;
1310 int t_iErr = this->get( rObjID, t_pPersistent, eMode );
1312 if ( t_pPersistent )
1314 rRetVal = std::shared_ptr<T>( t_pPersistent, Forgeter<T>() );
1319 template <
class T >
1325 if ( ! this->getBase() )
return ERR_NO_BASE;
1326 if ( this->getBase()->objIDInAllSet( rObjID, *
this ) )
1328 t_iErr = this->getBase()->getAnObject( prRetVal, rObjID );
1332 return ERR_OBJID_NOT_IN_ALLSET;
1337 template <
class T >
1343 t_iErr = this->open();
1347 if ( this->getBase()->objIDInAllSet( rObjID, *
this ) )
1349 t_iErr = this->getBase()->getAnObject( t_pReceivedObject, rObjID );
1352 prRetVal =
dynamic_cast<T*
>( t_pReceivedObject );
1355 t_pReceivedObject->
forget();
1356 t_iErr = ERR_WRONG_TYPE;
1362 return ERR_OBJID_NOT_IN_ALLSET;
1368 template <
class T >
1373 T * t_pPersistent = 0;
1374 int t_iErr = this->get( t_pPersistent, rObjID );
1376 if ( t_pPersistent )
1378 rRetVal = std::shared_ptr<T>( t_pPersistent, Forgeter<T>() );
1383 template <
class T >
1385 const ObjID & rObjID )
1387 return SUPER::getPersistent( rRetVal, rObjID );
1390 template <
class T >
1395 t_iErr = this->open();
1400 t_iErr = this->getBase()->getObjIdFromAllSet( t_ObjID, *
this, eMode );
1404 bool t_bIsKnownClassID =
false;
1406 t_iErr = this->getBase()->isKnownClassID( t_bIsKnownClassID, t_ObjID.
getClassID() );
1409 if ( ! t_bIsKnownClassID )
1412 if ( eMode == START || eMode == NEXT )
1414 t_iErr = this->getOndemand( prRetVal, NEXT );
1416 else if ( eMode == END || eMode == PREVIOUS )
1418 t_iErr = this->getOndemand( prRetVal, PREVIOUS );
1423 prRetVal =
new TOndemand<T>( t_ObjID, * this->getBase() );
1431 template <
class T >
1437 int t_iErr = this->getOndemand( t_pTempGloTOndemand, eMode );
1439 if ( t_pTempGloTOndemand )
1441 rRetVal = std::shared_ptr<T>( t_pTempGloTOndemand );
1446 template <
class T >
1450 int t_iErr = this->getOndemand( t_pTempGloTOndemand, eMode );
1452 if ( t_pTempGloTOndemand )
1454 rRetVal = * t_pTempGloTOndemand;
1455 delete t_pTempGloTOndemand;
1460 template <
class T >
1462 const std::string & rsIndexSearchValue,
1463 EnQueryType eQuerryType )
1466 std::vector< ObjID > t_ObjIDContainer;
1468 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1473 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1478 template <
class T >
1480 const std::string & rsFullIndexName,
1481 const std::string & rsIndexSearchValue,
1482 EnQueryType eQuerryType )
1485 std::vector< ObjID > t_ObjIDContainer;
1487 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1493 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1498 template <
class T >
1500 const std::string & rsIndexName,
1501 unsigned long ulIndexClassID,
1502 const std::string & rsIndexSearchValue,
1503 EnQueryType eQuerryType )
1506 std::vector< ObjID > t_ObjIDContainer;
1508 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1515 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1520 template <
class T >
1522 const std::string & rsIndexSearchValue,
1523 EnComparisionOp eComparisionOp )
1526 std::vector< ObjID > t_ObjIDContainer;
1528 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1534 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1539 template <
class T >
1541 const std::string & rsFullIndexName,
1542 const std::string & rsIndexSearchValue,
1543 EnComparisionOp eComparisionOp )
1546 std::vector< ObjID > t_ObjIDContainer;
1548 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1555 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1560 template <
class T >
1562 const std::string & rsIndexName,
1563 unsigned long ulIndexClassID,
1564 const std::string & rsIndexSearchValue,
1565 EnComparisionOp eComparisionOp )
1568 std::vector< ObjID > t_ObjIDContainer;
1570 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1578 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1583 template <
class T >
1585 const std::string & rsRangeStartIndex,
1586 const std::string & rsRangeEndIndex )
1589 std::vector< ObjID > t_ObjIDContainer;
1591 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1597 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1602 template <
class T >
1604 const std::string & rsFullIndexName,
1605 const std::string & rsRangeStartIndexSearchValue,
1606 const std::string & rsRangeEndIndexSearchValue )
1609 std::vector< ObjID > t_ObjIDContainer;
1611 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1613 rsRangeStartIndexSearchValue,
1614 rsRangeEndIndexSearchValue );
1618 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1623 template <
class T >
1625 const std::string & rsIndexName,
1626 unsigned long ulIndexClassID,
1627 const std::string & rsRangeStartIndexSearchValue,
1628 const std::string & rsRangeEndIndexSearchValue )
1631 std::vector< ObjID > t_ObjIDContainer;
1633 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1636 rsRangeStartIndexSearchValue,
1637 rsRangeEndIndexSearchValue );
1641 this->transferObjIListIntoOndemandVector( t_ObjIDContainer, rOndemandVector );
1646 template <
class T >
1649 int t_iErr = this->open();
1653 if ( ! this->getBase()->getObjectMaker() ) t_iErr = ERR_BASE_NOT_OPEN;
1660 pCallBack = t_pConstCastThis;
1662 t_iErr = this->getBase()->setWatchClass( this->getBase()->getObjectMaker()->getClassID(
this ),
1670 template <
class T >
1673 if ( ! this->getBase() )
return ERR_NO_BASE;
1674 if ( ! this->getBase()->getObjectMaker() )
return ERR_BASE_NOT_OPEN;
1680 pCallBack = t_pConstCastThis;
1682 return this->getBase()->unsetWatchClass( this->getBase()->getObjectMaker()->getClassID(
this ),
1683 ulWatchMode, pCallBack );
1686 template <
class T >
1690 for ( std::vector<ObjID>::const_iterator t_Iterator = rSourceContainer.begin();
1691 t_Iterator != rSourceContainer.end();
1694 rTargetVevtor.push_back(
TOndemand<T>( * t_Iterator, * this->getBase() ) );
#define NULL_PTR
Definition EuDef_NULL_PTR.h:74
Header for BasePersistent
#define SUPER
Definition GloTOndemand.h:328
Is the base class of template AllSets and the generic AllSet.
Definition GloBaseAllSet.h:80
friend class Base
Definition GloBaseAllSet.h:205
Abstract base class for Persistent and the generic GenericPersistent.
Definition GloBasePersistent.h:116
virtual unsigned int forget()
Superclass for the classes that are 'connected' to a Base.
Definition GloCallBack.h:74
std::string m_strDebugInfo
Definition GloCallBack.h:115
An object ID consists of the class ID, a database ID and the actual unique object number (all unsigne...
Definition GloObjID.h:77
unsigned long getClassID() const
AllSet, which returns objects from the database.
Definition GloTAllSet.h:185
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsIndexName, unsigned long ulIndexClassID, const std::string &rsRangeStartIndexSearchValue, const std::string &rsRangeEndIndexSearchValue)
Definition GloTAllSet.h:1624
virtual int getPersistent(std::shared_ptr< BasePersistent > &rRetVal, const glo::ObjID &rObjID)
Definition GloTAllSet.h:1384
int get(std::shared_ptr< T > &rRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1258
int get(glo::ObjID &rObjID, T *&prRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1265
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsIndexSearchValue, EnComparisionOp eComparisionOp)
Definition GloTAllSet.h:1521
int get(T *&prRetVal, const glo::ObjID &rObjID)
Returns an object from the AllSet of the database with passed object ID.
Definition GloTAllSet.h:1338
virtual int getPersistent(BasePersistent *&prRetVal, const glo::ObjID &rObjID)
Returns an object from the AllSet of the database with passed object ID.
Definition GloTAllSet.h:1320
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsIndexName, unsigned long ulIndexClassID, const std::string &rsIndexSearchValue, EnComparisionOp eComparisionOp)
Definition GloTAllSet.h:1561
int get(T *&prRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1251
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsFullIndexName, const std::string &rsIndexSearchValue, EnComparisionOp eComparisionOp)
Definition GloTAllSet.h:1540
TAllSet()
Definition GloTAllSet.h:1208
TAllSet(Base &rBase, bool bWithSubClasses=true)
Definition GloTAllSet.h:1219
int getOndemand(glo::TOndemand< T > &rRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1447
virtual int setWatch(TdWatchNotifyMode ulWatchMode, CallBack *pCallBack=0)
Definition GloTAllSet.h:1647
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsIndexName, unsigned long ulIndexClassID, const std::string &rsIndexSearchValue, EnQueryType eQuerryType)
Definition GloTAllSet.h:1499
int get(glo::ObjID &rObjID, std::shared_ptr< T > &rRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1305
virtual ~TAllSet()
Definition GloTAllSet.h:1246
int get(std::shared_ptr< T > &rRetVal, const glo::ObjID &rObjID)
Definition GloTAllSet.h:1369
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsFullIndexName, const std::string &rsIndexSearchValue, EnQueryType eQuerryType)
Definition GloTAllSet.h:1479
virtual int unsetWatch(TdWatchNotifyMode ulWatchMode, CallBack *pCallBack=0)
Definition GloTAllSet.h:1671
void transferObjIListIntoOndemandVector(const std::vector< glo::ObjID > &rSourceContainer, std::vector< glo::TOndemand< T > > &rTargetVevtor)
Definition GloTAllSet.h:1687
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsRangeStartIndex, const std::string &rsRangeEndIndex)
Definition GloTAllSet.h:1584
TAllSet(Base &rBase, const std::string &rsFullIndexName)
Definition GloTAllSet.h:1230
int getOndemand(std::shared_ptr< glo::TOndemand< T > > &rRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1432
TAllSet< T > & operator=(const TAllSet &)
int getOndemand(glo::TOndemand< T > *&prRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1391
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsIndexSearchValue, EnQueryType eQuerryType)
Definition GloTAllSet.h:1461
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandVector, const std::string &rsFullIndexName, const std::string &rsRangeStartIndexSearchValue, const std::string &rsRangeEndIndexSearchValue)
Definition GloTAllSet.h:1603
A reference (as attribute) of a persistent object to another persistent object in the database.
Definition GloTOndemand.h:89
Definition GloBasePersistent.h:52