GlobalObjects
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GloTAllSet.h
Go to the documentation of this file.
1#ifndef INC_GLOTALLSET_H
2#define INC_GLOTALLSET_H
3//-----------------------------------------------------------------------------
43//-----------------------------------------------------------------------------
44#include <list>
45#include "GloTypes.h"
46#include "GloBaseAllSet.h"
47#include "GloBasePersistent.h"
48#include "GloBase.h"
49#include "GloObjectMaker.h"
50//-----------------------------------------------------------------------------
51namespace glo
52{
53 //---------------------------------------------------------------------------
191 template < class T > class TAllSet : public BaseAllSet
192 {
193 public:
194 //============== Konstruktoren
195 //-----------------------------------------------------------------------
205 TAllSet();
206 //-----------------------------------------------------------------------
224 TAllSet( Base & rBase, bool bWithSubClasses = true );
225 //-----------------------------------------------------------------------
245 TAllSet( Base & rBase, const std::string & rsFullIndexName );
246 //-----------------------------------------------------------------------
266 TAllSet( Base & rBase, const char * pszFullIndexName );
267 //-----------------------------------------------------------------------
277 virtual ~TAllSet();
278 //-----------------------------------------------------------------------
279
280 private:
281 //============== Konstruktoren
282 //-----------------------------------------------------------------------
292 TAllSet( const TAllSet & );
293 //-----------------------------------------------------------------------
294
295 public:
296 //============== static methods
297 //-----------------------------------------------------------------------
309 static unsigned long getStaticGloClassID(){ return T::getStaticGloClassID();};
310 //-----------------------------------------------------------------------
311
312 public:
313 //============== Methoden
314 //-----------------------------------------------------------------------
360 int get( T *& prRetVal, EnSeekMode eMode );
361 //-----------------------------------------------------------------------
397 int get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode );
398 //-----------------------------------------------------------------------
451 int get( glo::ObjID & rObjID, T *& prRetVal, EnSeekMode eMode );
452 //-----------------------------------------------------------------------
494 int get( glo::ObjID & rObjID, std::shared_ptr<T> & rRetVal, EnSeekMode eMode );
495 //-----------------------------------------------------------------------
497
525 virtual int getPersistent( BasePersistent *& prRetVal, const glo::ObjID & rObjID );
526 int get( T *& prRetVal, const glo::ObjID & rObjID );
528 //-----------------------------------------------------------------------
546 int get( std::shared_ptr<T> & rRetVal, const glo::ObjID & rObjID );
547 //-----------------------------------------------------------------------
563 virtual int getPersistent( std::shared_ptr<BasePersistent> & rRetVal,
564 const glo::ObjID & rObjID );
565 //-----------------------------------------------------------------------
617 int getOndemand( glo::TOndemand<T> *& prRetVal, EnSeekMode eMode );
618 //-----------------------------------------------------------------------
654 int getOndemand( std::shared_ptr< glo::TOndemand<T> > & rRetVal, EnSeekMode eMode );
655 //-----------------------------------------------------------------------
692 int getOndemand( glo::TOndemand<T> & rRetVal, EnSeekMode eMode );
693 //-----------------------------------------------------------------------
695
727 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
728 const std::string & rsIndexSearchValue,
729 EnQueryType eQuerryType );
730 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
731 const std::string & rsIndexSearchValue,
732 EnQueryType eQuerryType );
734 //-----------------------------------------------------------------------
736
774 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
775 const std::string & rsFullIndexName,
776 const std::string & rsIndexSearchValue,
777 EnQueryType eQuerryType );
778 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
779 const std::string & rsFullIndexName,
780 const std::string & rsIndexSearchValue,
781 EnQueryType eQuerryType );
783 //-----------------------------------------------------------------------
785
828 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
829 const std::string & rsIndexName,
830 unsigned long ulIndexClassID,
831 const std::string & rsIndexSearchValue,
832 EnQueryType eQuerryType );
833 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
834 const std::string & rsIndexName,
835 unsigned long ulIndexClassID,
836 const std::string & rsIndexSearchValue,
837 EnQueryType eQuerryType );
839 //-----------------------------------------------------------------------
841
881 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
882 const std::string & rsIndexSearchValue,
883 EnComparisionOp eComparisionOp );
884 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
885 const std::string & rsIndexSearchValue,
886 EnComparisionOp eComparisionOp );
888 //-----------------------------------------------------------------------
890
935 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
936 const std::string & rsFullIndexName,
937 const std::string & rsIndexSearchValue,
938 EnComparisionOp eComparisionOp );
939 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
940 const std::string & rsFullIndexName,
941 const std::string & rsIndexSearchValue,
942 EnComparisionOp eComparisionOp );
944 //-----------------------------------------------------------------------
946
996 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
997 const std::string & rsIndexName,
998 unsigned long ulIndexClassID,
999 const std::string & rsIndexSearchValue,
1000 EnComparisionOp eComparisionOp );
1001 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
1002 const std::string & rsIndexName,
1003 unsigned long ulIndexClassID,
1004 const std::string & rsIndexSearchValue,
1005 EnComparisionOp eComparisionOp );
1007 //-----------------------------------------------------------------------
1009
1041 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
1042 const std::string & rsRangeStartIndex,
1043 const std::string & rsRangeEndIndex );
1044 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
1045 const std::string & rsRangeStartIndex,
1046 const std::string & rsRangeEndIndex );
1048 //-----------------------------------------------------------------------
1050
1090 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
1091 const std::string & rsFullIndexName,
1092 const std::string & rsRangeStartIndexSearchValue,
1093 const std::string & rsRangeEndIndexSearchValue );
1094 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
1095 const std::string & rsFullIndexName,
1096 const std::string & rsRangeStartIndexSearchValue,
1097 const std::string & rsRangeEndIndexSearchValue );
1099 //-----------------------------------------------------------------------
1101
1147 int getIndexedOndemands( std::vector< glo::TOndemand<T> > & rOndemandContainer,
1148 const std::string & rsIndexName,
1149 unsigned long ulIndexClassID,
1150 const std::string & rsRangeStartIndexSearchValue,
1151 const std::string & rsRangeEndIndexSearchValue );
1152 int getIndexedOndemands( glo::TOndemandList<T> & rOndemandContainer,
1153 const std::string & rsIndexName,
1154 unsigned long ulIndexClassID,
1155 const std::string & rsRangeStartIndexSearchValue,
1156 const std::string & rsRangeEndIndexSearchValue );
1158 //-----------------------------------------------------------------------
1211 virtual int setWatch( TdWatchNotifyMode ulWatchMode, CallBack * pCallBack = 0 );
1212 //-----------------------------------------------------------------------
1256 virtual int unsetWatch( TdWatchNotifyMode ulWatchMode, CallBack * pCallBack = 0 );
1257 //-----------------------------------------------------------------------
1258
1259 private:
1260 //============== Methoden
1261 //-----------------------------------------------------------------------
1263
1280 void transferObjIListIntoOndemandContainer( const std::vector< glo::ObjID > & rSourceContainer,
1281 std::vector< glo::TOndemand<T> > & rTargetConteiner );
1282 void transferObjIListIntoOndemandContainer( const std::vector< glo::ObjID > & rSourceContainer,
1283 glo::TOndemandList<T> & rTargetConteiner );
1285 //-----------------------------------------------------------------------
1286
1287 //============== Operatoren
1288 //-----------------------------------------------------------------------
1299 //-----------------------------------------------------------------------
1300 };
1301 //---------------------------------------------------------------------------
1302 #define SUPER BaseAllSet
1303 //---------------------------------------------------------------------------
1304 template < class T >
1306 : SUPER()
1307 {
1308 #ifdef _DEBUG
1309 m_strDebugInfo = "TAllSet";
1310 #endif
1311 SUPER::setClassIDFromTemplate( T::getStaticGloClassID() );
1312 }
1313 //---------------------------------------------------------------------------
1314 template < class T >
1315 TAllSet< T >::TAllSet( Base & rBase, bool bWithSubClasses )
1316 : SUPER( rBase, 0, bWithSubClasses )
1317 {
1318 #ifdef _DEBUG
1319 m_strDebugInfo = "TAllSet";
1320 #endif
1321 SUPER::setClassIDFromTemplate( T::getStaticGloClassID() );
1322 }
1323 //---------------------------------------------------------------------------
1324 template < class T >
1325 TAllSet< T >::TAllSet( Base & rBase, const std::string & rsFullIndexName )
1326 : SUPER( rBase, 0 )
1327 {
1328 #ifdef _DEBUG
1329 m_strDebugInfo = "TAllSet";
1330 #endif
1331 SUPER::setClassIDFromTemplate( T::getStaticGloClassID() );
1332 int t_iErr = SUPER::setFullIndexName( rsFullIndexName );
1333 if ( t_iErr )
1334 {
1335 throw eut::ErrorNException( "TAllSet::setBase(Base * pBase, unsigned long ulClassID, const std::string & rsFullIndexName)", t_iErr, __FILE__, __LINE__ );
1336 }
1337 }
1338 //---------------------------------------------------------------------------
1339 template < class T >
1340 TAllSet< T >::TAllSet( Base & rBase, const char * pszFullIndexName )
1341 : SUPER( rBase, 0 )
1342 {
1343 #ifdef _DEBUG
1344 m_strDebugInfo = "TAllSet";
1345 #endif
1346 SUPER::setClassIDFromTemplate( T::getStaticGloClassID() );
1347 int t_iErr = SUPER::setFullIndexName( pszFullIndexName );
1348 if ( t_iErr )
1349 {
1350 throw eut::ErrorNException( "TAllSet::setBase(Base * pBase, unsigned long ulClassID, const std::string & rsFullIndexName)", t_iErr, __FILE__, __LINE__ );
1351 }
1352 }
1353 //---------------------------------------------------------------------------
1354 template < class T >
1356 {
1357 }
1358 //---------------------------------------------------------------------------
1359 template < class T >
1360 int TAllSet< T >::get( T *& prRetVal, EnSeekMode eMode )
1361 {
1362 ObjID t_TempObjID;
1363 return this->get( t_TempObjID, prRetVal, eMode );
1364 }
1365 //---------------------------------------------------------------------------
1366 template < class T >
1367 int TAllSet< T >::get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode )
1368 {
1369 ObjID t_TempObjID;
1370 return this->get( t_TempObjID, rRetVal, eMode );
1371 }
1372 //---------------------------------------------------------------------------
1373 template < class T >
1374 int TAllSet< T >::get( ObjID & rObjID, T *& prRetVal, EnSeekMode eMode )
1375 {
1376 int t_iErr = 0;
1377
1378 prRetVal = nullptr;
1379 t_iErr = this->open();
1380 if ( ! t_iErr )
1381 {
1382 BasePersistent * t_pGetObj = nullptr;
1383
1384 t_iErr = this->getBase()->getObjectFromAllSet( rObjID, t_pGetObj, *this, eMode );
1385 if ( ! t_iErr )
1386 {
1387 do
1388 {
1389 prRetVal = dynamic_cast<T*>( t_pGetObj );
1390 if ( ! prRetVal )
1391 {
1392 t_pGetObj->forget();
1393
1394 if ( eMode == glo::START || eMode == glo::NEXT )
1395 {
1396 t_iErr = this->getBase()->getObjectFromAllSet( rObjID, t_pGetObj, *this, glo::NEXT );
1397 }
1398 else if ( eMode == glo::END || eMode == glo::PREVIOUS )
1399 {
1400 t_iErr = this->getBase()->getObjectFromAllSet( rObjID, t_pGetObj, *this, glo::PREVIOUS );
1401 }
1402 }
1403 else
1404 {
1405 break;
1406 }
1407 } while ( ! t_iErr );
1408 }
1409 }
1410 return t_iErr;
1411 }
1412 //---------------------------------------------------------------------------
1413 template < class T >
1414 int TAllSet< T >::get( ObjID & rObjID, std::shared_ptr<T> & rRetVal, EnSeekMode eMode )
1415 {
1416 T * t_pPersistent = nullptr;
1417 int t_iErr = this->get( rObjID, t_pPersistent, eMode );
1418
1419 if ( t_pPersistent )
1420 {
1421 rRetVal = std::shared_ptr<T>( t_pPersistent, Forgetter<T>() );
1422 }
1423 else
1424 {
1425 rRetVal.reset();
1426 }
1427 return t_iErr;
1428 }
1429 //---------------------------------------------------------------------------
1430 template < class T >
1431 int TAllSet< T >::getPersistent( BasePersistent *& prRetVal, const ObjID & rObjID )
1432 {
1433 int t_iErr = 0;
1434
1435 prRetVal = nullptr;
1436 if ( ! this->getBase() ) return ERR_NO_BASE;
1437 //if ( this->getBase()->objIDInAllSet( rObjID, *this ) )
1438 //{
1439 t_iErr = this->getBase()->getAnObject( prRetVal, rObjID );
1440 //}
1441 //else
1442 //{
1443 // return ERR_OBJID_NOT_IN_ALLSET;
1444 //}
1445 return t_iErr;
1446 }
1447 //---------------------------------------------------------------------------
1448 template < class T >
1449 int TAllSet< T >::get( T *& prRetVal, const ObjID & rObjID )
1450 {
1451 int t_iErr = 0;
1452
1453 prRetVal = nullptr;
1454 t_iErr = this->open();
1455 if ( ! t_iErr )
1456 {
1457 BasePersistent * t_pReceivedObject = nullptr;
1458 //if ( this->getBase()->objIDInAllSet( rObjID, *this ) )
1459 //{
1460 t_iErr = this->getBase()->getAnObject( t_pReceivedObject, rObjID );
1461 if ( ! t_iErr )
1462 {
1463 prRetVal = dynamic_cast<T*>( t_pReceivedObject );
1464 if ( ! prRetVal )
1465 {
1466 t_pReceivedObject->forget();
1467 t_iErr = ERR_WRONG_TYPE;
1468 }
1469 }
1470 //}
1471 //else
1472 //{
1473 // return ERR_OBJID_NOT_IN_ALLSET;
1474 //}
1475 }
1476 return t_iErr;
1477 }
1478 //---------------------------------------------------------------------------
1479 template < class T >
1480 int TAllSet< T >::get( std::shared_ptr<T> & rRetVal, const ObjID & rObjID )
1481 {
1482 T * t_pPersistent = nullptr;
1483 int t_iErr = this->get( t_pPersistent, rObjID );
1484
1485 if ( t_pPersistent )
1486 {
1487 rRetVal = std::shared_ptr<T>( t_pPersistent, Forgetter<T>() );
1488 }
1489 else
1490 {
1491 rRetVal.reset();
1492 }
1493 return t_iErr;
1494 }
1495 //---------------------------------------------------------------------------
1496 template < class T >
1497 int TAllSet< T >::getPersistent( std::shared_ptr<BasePersistent> & rRetVal,
1498 const ObjID & rObjID )
1499 {
1500 return SUPER::getPersistent( rRetVal, rObjID );
1501 }
1502 //---------------------------------------------------------------------------
1503 template < class T >
1505 {
1506 int t_iErr = 0;
1507
1508 t_iErr = this->open();
1509 if ( ! t_iErr )
1510 {
1511 ObjID t_ObjID;
1512
1513 t_iErr = this->getBase()->getObjIdFromAllSet( t_ObjID, *this, eMode );
1514 if ( ! t_iErr )
1515 {
1516 // Erfragen, ob ObjID-Klasse hier verarbeitbar
1517 bool t_bIsKnownClassID = false;
1518
1519 t_iErr = this->getBase()->isKnownClassID( t_bIsKnownClassID, t_ObjID.getClassID() );
1520 if ( ! t_iErr )
1521 {
1522 if ( ! t_bIsKnownClassID )
1523 {
1524 // Unbekannte Klasse! Auch OK, dann nächstes oder vorheriges Objekt
1525 if ( eMode == START || eMode == NEXT )
1526 {
1527 t_iErr = this->getOndemand( prRetVal, NEXT );
1528 }
1529 else if ( eMode == END || eMode == PREVIOUS )
1530 {
1531 t_iErr = this->getOndemand( prRetVal, PREVIOUS );
1532 }
1533 }
1534 else
1535 {
1536 prRetVal = new TOndemand<T>( t_ObjID, * this->getBase() );
1537 }
1538 }
1539 }
1540 }
1541 return t_iErr;
1542 }
1543 //---------------------------------------------------------------------------
1544 template < class T >
1545 int TAllSet< T >::getOndemand( std::shared_ptr< TOndemand<T> > & rRetVal, EnSeekMode eMode )
1546 {
1547 TOndemand<T> * t_pTempGloTOndemand = nullptr;
1548 int t_iErr = this->getOndemand( t_pTempGloTOndemand, eMode );
1549
1550 if ( t_pTempGloTOndemand )
1551 {
1552 rRetVal = std::shared_ptr<T>( t_pTempGloTOndemand );
1553 }
1554 else
1555 {
1556 rRetVal.reset();
1557 }
1558 return t_iErr;
1559 }
1560 //---------------------------------------------------------------------------
1561 template < class T >
1563 {
1564 TOndemand<T> * t_pTempGloTOndemand = nullptr;
1565 int t_iErr = this->getOndemand( t_pTempGloTOndemand, eMode );
1566
1567 if ( t_pTempGloTOndemand )
1568 {
1569 rRetVal = * t_pTempGloTOndemand;
1570 delete t_pTempGloTOndemand;
1571 }
1572 return t_iErr;
1573 }
1574 //---------------------------------------------------------------------------
1575 template < class T >
1576 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1577 const std::string & rsIndexSearchValue,
1578 EnQueryType eQuerryType )
1579 {
1580 int t_iErr = 0;
1581 std::vector< ObjID > t_ObjIDContainer;
1582
1583 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1584 rsIndexSearchValue,
1585 eQuerryType );
1586 if ( ! t_iErr )
1587 {
1588 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1589 }
1590 return t_iErr;
1591 }
1592 //---------------------------------------------------------------------------
1593 template < class T >
1595 const std::string & rsIndexSearchValue,
1596 EnQueryType eQuerryType )
1597 {
1598 int t_iErr = 0;
1599 std::vector< ObjID > t_ObjIDContainer;
1600
1601 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1602 rsIndexSearchValue,
1603 eQuerryType );
1604 if ( ! t_iErr )
1605 {
1606 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1607 }
1608 return t_iErr;
1609 }
1610 //---------------------------------------------------------------------------
1611 template < class T >
1612 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1613 const std::string & rsFullIndexName,
1614 const std::string & rsIndexSearchValue,
1615 EnQueryType eQuerryType )
1616 {
1617 int t_iErr = 0;
1618 std::vector< ObjID > t_ObjIDContainer;
1619
1620 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1621 rsFullIndexName,
1622 rsIndexSearchValue,
1623 eQuerryType );
1624 if ( ! t_iErr )
1625 {
1626 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1627 }
1628 return t_iErr;
1629 }
1630 //---------------------------------------------------------------------------
1631 template < class T >
1633 const std::string & rsFullIndexName,
1634 const std::string & rsIndexSearchValue,
1635 EnQueryType eQuerryType )
1636 {
1637 int t_iErr = 0;
1638 std::vector< ObjID > t_ObjIDContainer;
1639
1640 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1641 rsFullIndexName,
1642 rsIndexSearchValue,
1643 eQuerryType );
1644 if ( ! t_iErr )
1645 {
1646 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1647 }
1648 return t_iErr;
1649 }
1650 //---------------------------------------------------------------------------
1651 template < class T >
1652 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1653 const std::string & rsIndexName,
1654 unsigned long ulIndexClassID,
1655 const std::string & rsIndexSearchValue,
1656 EnQueryType eQuerryType )
1657 {
1658 int t_iErr = 0;
1659 std::vector< ObjID > t_ObjIDContainer;
1660
1661 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1662 rsIndexName,
1663 ulIndexClassID,
1664 rsIndexSearchValue,
1665 eQuerryType );
1666 if ( ! t_iErr )
1667 {
1668 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1669 }
1670 return t_iErr;
1671 }
1672 //---------------------------------------------------------------------------
1673 template < class T >
1675 const std::string & rsIndexName,
1676 unsigned long ulIndexClassID,
1677 const std::string & rsIndexSearchValue,
1678 EnQueryType eQuerryType )
1679 {
1680 int t_iErr = 0;
1681 std::vector< ObjID > t_ObjIDContainer;
1682
1683 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1684 rsIndexName,
1685 ulIndexClassID,
1686 rsIndexSearchValue,
1687 eQuerryType );
1688 if ( ! t_iErr )
1689 {
1690 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1691 }
1692 return t_iErr;
1693 }
1694 //---------------------------------------------------------------------------
1695 template < class T >
1696 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1697 const std::string & rsIndexSearchValue,
1698 EnComparisionOp eComparisionOp )
1699 {
1700 int t_iErr = 0;
1701 std::vector< ObjID > t_ObjIDContainer;
1702
1703 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1704 rsIndexSearchValue,
1705 eComparisionOp );
1706
1707 if ( ! t_iErr )
1708 {
1709 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1710 }
1711 return t_iErr;
1712 }
1713 //---------------------------------------------------------------------------
1714 template < class T >
1716 const std::string & rsIndexSearchValue,
1717 EnComparisionOp eComparisionOp )
1718 {
1719 int t_iErr = 0;
1720 std::vector< ObjID > t_ObjIDContainer;
1721
1722 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1723 rsIndexSearchValue,
1724 eComparisionOp );
1725
1726 if ( ! t_iErr )
1727 {
1728 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1729 }
1730 return t_iErr;
1731 }
1732 //---------------------------------------------------------------------------
1733 template < class T >
1734 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1735 const std::string & rsFullIndexName,
1736 const std::string & rsIndexSearchValue,
1737 EnComparisionOp eComparisionOp )
1738 {
1739 int t_iErr = 0;
1740 std::vector< ObjID > t_ObjIDContainer;
1741
1742 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1743 rsFullIndexName,
1744 rsIndexSearchValue,
1745 eComparisionOp );
1746
1747 if ( ! t_iErr )
1748 {
1749 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1750 }
1751 return t_iErr;
1752 }
1753 //---------------------------------------------------------------------------
1754 template < class T >
1756 const std::string & rsFullIndexName,
1757 const std::string & rsIndexSearchValue,
1758 EnComparisionOp eComparisionOp )
1759 {
1760 int t_iErr = 0;
1761 std::vector< ObjID > t_ObjIDContainer;
1762
1763 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1764 rsFullIndexName,
1765 rsIndexSearchValue,
1766 eComparisionOp );
1767
1768 if ( ! t_iErr )
1769 {
1770 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1771 }
1772 return t_iErr;
1773 }
1774 //---------------------------------------------------------------------------
1775 template < class T >
1776 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1777 const std::string & rsIndexName,
1778 unsigned long ulIndexClassID,
1779 const std::string & rsIndexSearchValue,
1780 EnComparisionOp eComparisionOp )
1781 {
1782 int t_iErr = 0;
1783 std::vector< ObjID > t_ObjIDContainer;
1784
1785 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1786 rsIndexName,
1787 ulIndexClassID,
1788 rsIndexSearchValue,
1789 eComparisionOp );
1790
1791 if ( ! t_iErr )
1792 {
1793 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1794 }
1795 return t_iErr;
1796 }
1797 //---------------------------------------------------------------------------
1798 template < class T >
1800 const std::string & rsIndexName,
1801 unsigned long ulIndexClassID,
1802 const std::string & rsIndexSearchValue,
1803 EnComparisionOp eComparisionOp )
1804 {
1805 int t_iErr = 0;
1806 std::vector< ObjID > t_ObjIDContainer;
1807
1808 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1809 rsIndexName,
1810 ulIndexClassID,
1811 rsIndexSearchValue,
1812 eComparisionOp );
1813
1814 if ( ! t_iErr )
1815 {
1816 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1817 }
1818 return t_iErr;
1819 }
1820 //---------------------------------------------------------------------------
1821 template < class T >
1822 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1823 const std::string & rsRangeStartIndex,
1824 const std::string & rsRangeEndIndex )
1825 {
1826 int t_iErr = 0;
1827 std::vector< ObjID > t_ObjIDContainer;
1828
1829 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1830 rsRangeStartIndex,
1831 rsRangeEndIndex );
1832
1833 if ( ! t_iErr )
1834 {
1835 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1836 }
1837 return t_iErr;
1838 }
1839 //---------------------------------------------------------------------------
1840 template < class T >
1842 const std::string & rsRangeStartIndex,
1843 const std::string & rsRangeEndIndex )
1844 {
1845 int t_iErr = 0;
1846 std::vector< ObjID > t_ObjIDContainer;
1847
1848 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1849 rsRangeStartIndex,
1850 rsRangeEndIndex );
1851
1852 if ( ! t_iErr )
1853 {
1854 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1855 }
1856 return t_iErr;
1857 }
1858 //---------------------------------------------------------------------------
1859 template < class T >
1860 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1861 const std::string & rsFullIndexName,
1862 const std::string & rsRangeStartIndexSearchValue,
1863 const std::string & rsRangeEndIndexSearchValue )
1864 {
1865 int t_iErr = 0;
1866 std::vector< ObjID > t_ObjIDContainer;
1867
1868 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1869 rsFullIndexName,
1870 rsRangeStartIndexSearchValue,
1871 rsRangeEndIndexSearchValue );
1872
1873 if ( ! t_iErr )
1874 {
1875 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1876 }
1877 return t_iErr;
1878 }
1879 //---------------------------------------------------------------------------
1880 template < class T >
1882 const std::string & rsFullIndexName,
1883 const std::string & rsRangeStartIndexSearchValue,
1884 const std::string & rsRangeEndIndexSearchValue )
1885 {
1886 int t_iErr = 0;
1887 std::vector< ObjID > t_ObjIDContainer;
1888
1889 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1890 rsFullIndexName,
1891 rsRangeStartIndexSearchValue,
1892 rsRangeEndIndexSearchValue );
1893
1894 if ( ! t_iErr )
1895 {
1896 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1897 }
1898 return t_iErr;
1899 }
1900 //---------------------------------------------------------------------------
1901 template < class T >
1902 int TAllSet< T >::getIndexedOndemands( std::vector< TOndemand<T> > & rOndemandContainer,
1903 const std::string & rsIndexName,
1904 unsigned long ulIndexClassID,
1905 const std::string & rsRangeStartIndexSearchValue,
1906 const std::string & rsRangeEndIndexSearchValue )
1907 {
1908 int t_iErr = 0;
1909 std::vector< ObjID > t_ObjIDContainer;
1910
1911 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1912 rsIndexName,
1913 ulIndexClassID,
1914 rsRangeStartIndexSearchValue,
1915 rsRangeEndIndexSearchValue );
1916
1917 if ( ! t_iErr )
1918 {
1919 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1920 }
1921 return t_iErr;
1922 }
1923 //---------------------------------------------------------------------------
1924 template < class T >
1926 const std::string & rsIndexName,
1927 unsigned long ulIndexClassID,
1928 const std::string & rsRangeStartIndexSearchValue,
1929 const std::string & rsRangeEndIndexSearchValue )
1930 {
1931 int t_iErr = 0;
1932 std::vector< ObjID > t_ObjIDContainer;
1933
1934 t_iErr = this->getIndexedObjIds( t_ObjIDContainer,
1935 rsIndexName,
1936 ulIndexClassID,
1937 rsRangeStartIndexSearchValue,
1938 rsRangeEndIndexSearchValue );
1939
1940 if ( ! t_iErr )
1941 {
1942 this->transferObjIListIntoOndemandContainer( t_ObjIDContainer, rOndemandContainer );
1943 }
1944 return t_iErr;
1945 }
1946 //---------------------------------------------------------------------------
1947 template < class T >
1948 int TAllSet< T >::setWatch( TdWatchNotifyMode ulWatchMode, CallBack * pCallBack )
1949 {
1950 int t_iErr = this->open();
1951
1952 if ( ! t_iErr )
1953 {
1954 if ( ! this->getBase()->getObjectMaker() ) t_iErr = ERR_BASE_NOT_OPEN;
1955 if ( ! t_iErr )
1956 {
1957 if ( ! pCallBack )
1958 {
1959 TAllSet< T > * t_pConstCastThis = const_cast<TAllSet< T >*>( this );
1960
1961 pCallBack = t_pConstCastThis;
1962 }
1963 t_iErr = this->getBase()->setWatchClass( this->getClassID(),
1964 ulWatchMode,
1965 pCallBack );
1966 }
1967 }
1968 return t_iErr;
1969 }
1970 //---------------------------------------------------------------------------
1971 template < class T >
1973 {
1974 if ( ! this->getBase() ) return ERR_NO_BASE;
1975 if ( ! this->getBase()->getObjectMaker() ) return ERR_BASE_NOT_OPEN;
1976
1977 if ( ! pCallBack )
1978 {
1979 TAllSet< T > * t_pConstCastThis = const_cast<TAllSet< T >*>( this );
1980
1981 pCallBack = t_pConstCastThis;
1982 }
1983 return this->getBase()->unsetWatchClass( this->getClassID(),
1984 ulWatchMode, pCallBack );
1985 }
1986 //---------------------------------------------------------------------------
1987 template < class T >
1988 void TAllSet< T >::transferObjIListIntoOndemandContainer( const std::vector< glo::ObjID > & rSourceContainer,
1989 std::vector< TOndemand<T> > & rTargetContainer )
1990 {
1991 for ( std::vector<ObjID>::const_iterator t_Iterator = rSourceContainer.begin();
1992 t_Iterator != rSourceContainer.end();
1993 ++t_Iterator )
1994 {
1995 TOndemand<T> t_odTemp;
1996
1997 int t_iErr = t_odTemp.set( * t_Iterator );
1998 if ( t_iErr )
1999 {
2000 throw eut::ErrorNException( "TAllSet< T >::transferObjIListIntoOndemandContainer(...)", t_iErr, __FILE__, __LINE__ );
2001 }
2002 rTargetContainer.push_back( t_odTemp );
2003 }
2004 }
2005 //---------------------------------------------------------------------------
2006 template < class T >
2007 void TAllSet< T >::transferObjIListIntoOndemandContainer( const std::vector< glo::ObjID > & rSourceContainer,
2008 glo::TOndemandList<T> & rTargetContainer )
2009 {
2010 for ( std::vector<ObjID>::const_iterator t_Iterator = rSourceContainer.begin();
2011 t_Iterator != rSourceContainer.end();
2012 ++t_Iterator )
2013 {
2014 TOndemand<T> t_odTemp;
2015
2016 int t_iErr = t_odTemp.set( * t_Iterator );
2017 if ( t_iErr )
2018 {
2019 throw eut::ErrorNException( "TAllSet< T >::transferObjIListIntoOndemandContainer(...)", t_iErr, __FILE__, __LINE__ );
2020 }
2021 rTargetContainer.appendOndemand( t_odTemp );
2022 }
2023 }
2024 //---------------------------------------------------------------------------
2025 #undef SUPER
2026 //---------------------------------------------------------------------------
2027} // namespace glo
2028#endif
Header for Base
Header for BaseAllSet
Header for BasePersistent
Header for ObjectMaker
#define SUPER
Definition GloTAllSet.h:1302
For each library, here 'GlobalObjects' there is a type file.
This exception class has an integer attribute for an error number in addition to the message.
Definition EuException.h:90
int getIndexedObjIds(std::vector< glo::ObjID > &rObjIDContainer, const std::string &rsIndexSearchValue, EnQueryType eQuerryType)
friend class Base
Definition GloBaseAllSet.h:212
virtual Base * getBase() const override
unsigned long getClassID() const
Abstract base class for Persistent and the generic GenericPersistent.
Definition GloBasePersistent.h:124
virtual unsigned int forget()
Superclass for the classes that are 'connected' to a Base.
Definition GloCallBack.h:81
std::string m_strDebugInfo
Definition GloCallBack.h:111
Especially for GenericPersistent or derived classes of Persistent the Forget method for std::shared_p...
Definition GloTypes.h:1253
An object ID consists of the class ID, a database ID and the actual unique object number (all unsigne...
Definition GloObjID.h:84
unsigned long getClassID() const
virtual int appendOndemand(const Reference &rNewOndemand)
int getIndexedOndemands(std::vector< glo::TOndemand< T > > &rOndemandContainer, const std::string &rsIndexSearchValue, EnQueryType eQuerryType)
Returns a container of glo::TOndemand's from AllSet in relation to the passed parameters.
Definition GloTAllSet.h:1576
void transferObjIListIntoOndemandContainer(const std::vector< glo::ObjID > &rSourceContainer, std::vector< glo::TOndemand< T > > &rTargetConteiner)
Transfers the glo::ObjID's from the transferred rSourceContainer as glo::TOndemand's into the transfe...
Definition GloTAllSet.h:1988
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:1431
int get(T *&prRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1360
TAllSet()
Definition GloTAllSet.h:1305
virtual int setWatch(TdWatchNotifyMode ulWatchMode, CallBack *pCallBack=0)
Definition GloTAllSet.h:1948
TAllSet(const TAllSet &)
static unsigned long getStaticGloClassID()
Definition GloTAllSet.h:309
virtual ~TAllSet()
Definition GloTAllSet.h:1355
virtual int unsetWatch(TdWatchNotifyMode ulWatchMode, CallBack *pCallBack=0)
Definition GloTAllSet.h:1972
TAllSet< T > & operator=(const TAllSet &)
int getOndemand(glo::TOndemand< T > *&prRetVal, EnSeekMode eMode)
Definition GloTAllSet.h:1504
Definition GloTOndemand.h:209
int set(const T *rObj)
Adopts the object ID of the passed object as reference.
Definition GloTOndemand.h:535
A type-safe list of references to persistent objects in the database (intended as an attribute for pe...
Definition GloTOndemandList.h:95
Definition GloAbstractBaseLot.h:49
@ ERR_NO_BASE
Definition GloErrors.h:584
@ ERR_BASE_NOT_OPEN
Definition GloErrors.h:617
@ ERR_WRONG_TYPE
Definition GloErrors.h:551
EnComparisionOp
Definition GloTypes.h:1586
EnSeekMode
Definition GloTypes.h:192
@ END
Definition GloTypes.h:214
@ START
Definition GloTypes.h:203
@ PREVIOUS
Definition GloTypes.h:247
@ NEXT
Definition GloTypes.h:236
EnQueryType
Definition GloTypes.h:1183
unsigned long TdWatchNotifyMode
Definition GloTypes.h:577