1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2021 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 /////////////////////////////////////////////////////////////////
18 // WARNING : this is a generated file, don't change it !
19 /////////////////////////////////////////////////////////////////
21 #ifndef DATABASE_MAPPING
22 #define DATABASE_MAPPING
23 #include "nel/misc/types_nl.h"
25 #include "nel/misc/hierarchical_timer.h"
26 #include "nel/misc/string_conversion.h"
27 #include "nel/net/message.h"
28 #include "nel/net/module.h"
29 #include "nel/net/module_builder_parts.h"
30 #include "nel/net/module_message.h"
31 #include "nel/net/module_gateway.h"
33 #include "nel/misc/string_common.h"
34 #include "server_share/mysql_wrapper.h"
36 #include "ring_session_manager.h"
38 #include "game_share/ring_session_manager_itf.h"
40 #include "game_share/character_sync_itf.h"
48 class CSessionParticipant
;
50 class CSessionParticipantPtr
;
68 class CGuildInvitePtr
;
71 class CPlayerRatingPtr
;
74 class CJournalEntryPtr
;
80 class CFolderAccessPtr
;
95 friend class CKnownUser
;
97 const char *_FileName
;
100 // linked list of smart ptr
101 CKnownUserPtr
*_NextPtr
;
102 CKnownUserPtr
*_PrevPtr
;
120 CKnownUserPtr(const CKnownUserPtr
&other
, const char *filename
, uint32 lineNum
)
121 : _FileName(filename
),
126 // point the same object
128 // insert the pointer in the list
132 CKnownUserPtr(const CKnownUserPtr
&other
)
133 : _FileName(other
._FileName
),
134 _LineNum(other
._LineNum
),
138 // point the same object
140 // insert the pointer in the list
144 CKnownUserPtr(CKnownUser
*objectPtr
, const char *filename
, uint32 lineNum
)
145 : _FileName(filename
),
155 CKnownUserPtr
&assign(const CKnownUserPtr
&other
, const char *filename
, uint32 lineNum
)
157 _FileName
= filename
;
172 CKnownUserPtr
&assign(CKnownUser
*objectPtr
, const char *filename
, uint32 lineNum
)
174 _FileName
= filename
;
184 CKnownUserPtr
&operator =(const CKnownUserPtr
&other
)
186 return assign(other
, __FILE__
, __LINE__
);
189 CKnownUser
*operator ->()
193 const CKnownUser
*operator ->() const
198 bool operator == (const CKnownUserPtr
&other
) const
200 return _Ptr
== other
._Ptr
;
202 bool operator != (const CKnownUserPtr
&other
) const
204 return !operator ==(other
);
207 bool operator == (const CKnownUser
*object
) const
209 return _Ptr
== object
;
211 bool operator != (const CKnownUser
*object
) const
213 return !operator ==(object
);
216 /// Less then comparator : comparison on pointer object address
217 bool operator < (const CKnownUserPtr
&other
) const
219 return _Ptr
< other
._Ptr
;
222 /// Used to walk thrue the linked list of pointer
223 CKnownUserPtr
*getNextPtr()
233 class CSessionParticipantPtr
235 friend class CSessionParticipant
;
237 const char *_FileName
;
240 // linked list of smart ptr
241 CSessionParticipantPtr
*_NextPtr
;
242 CSessionParticipantPtr
*_PrevPtr
;
244 CSessionParticipant
*_Ptr
;
251 CSessionParticipantPtr()
260 CSessionParticipantPtr(const CSessionParticipantPtr
&other
, const char *filename
, uint32 lineNum
)
261 : _FileName(filename
),
266 // point the same object
268 // insert the pointer in the list
272 CSessionParticipantPtr(const CSessionParticipantPtr
&other
)
273 : _FileName(other
._FileName
),
274 _LineNum(other
._LineNum
),
278 // point the same object
280 // insert the pointer in the list
284 CSessionParticipantPtr(CSessionParticipant
*objectPtr
, const char *filename
, uint32 lineNum
)
285 : _FileName(filename
),
295 CSessionParticipantPtr
&assign(const CSessionParticipantPtr
&other
, const char *filename
, uint32 lineNum
)
297 _FileName
= filename
;
307 ~CSessionParticipantPtr()
312 CSessionParticipantPtr
&assign(CSessionParticipant
*objectPtr
, const char *filename
, uint32 lineNum
)
314 _FileName
= filename
;
324 CSessionParticipantPtr
&operator =(const CSessionParticipantPtr
&other
)
326 return assign(other
, __FILE__
, __LINE__
);
329 CSessionParticipant
*operator ->()
333 const CSessionParticipant
*operator ->() const
338 bool operator == (const CSessionParticipantPtr
&other
) const
340 return _Ptr
== other
._Ptr
;
342 bool operator != (const CSessionParticipantPtr
&other
) const
344 return !operator ==(other
);
347 bool operator == (const CSessionParticipant
*object
) const
349 return _Ptr
== object
;
351 bool operator != (const CSessionParticipant
*object
) const
353 return !operator ==(object
);
356 /// Less then comparator : comparison on pointer object address
357 bool operator < (const CSessionParticipantPtr
&other
) const
359 return _Ptr
< other
._Ptr
;
362 /// Used to walk thrue the linked list of pointer
363 CSessionParticipantPtr
*getNextPtr()
375 friend class CCharacter
;
377 const char *_FileName
;
380 // linked list of smart ptr
381 CCharacterPtr
*_NextPtr
;
382 CCharacterPtr
*_PrevPtr
;
400 CCharacterPtr(const CCharacterPtr
&other
, const char *filename
, uint32 lineNum
)
401 : _FileName(filename
),
406 // point the same object
408 // insert the pointer in the list
412 CCharacterPtr(const CCharacterPtr
&other
)
413 : _FileName(other
._FileName
),
414 _LineNum(other
._LineNum
),
418 // point the same object
420 // insert the pointer in the list
424 CCharacterPtr(CCharacter
*objectPtr
, const char *filename
, uint32 lineNum
)
425 : _FileName(filename
),
435 CCharacterPtr
&assign(const CCharacterPtr
&other
, const char *filename
, uint32 lineNum
)
437 _FileName
= filename
;
452 CCharacterPtr
&assign(CCharacter
*objectPtr
, const char *filename
, uint32 lineNum
)
454 _FileName
= filename
;
464 CCharacterPtr
&operator =(const CCharacterPtr
&other
)
466 return assign(other
, __FILE__
, __LINE__
);
469 CCharacter
*operator ->()
473 const CCharacter
*operator ->() const
478 bool operator == (const CCharacterPtr
&other
) const
480 return _Ptr
== other
._Ptr
;
482 bool operator != (const CCharacterPtr
&other
) const
484 return !operator ==(other
);
487 bool operator == (const CCharacter
*object
) const
489 return _Ptr
== object
;
491 bool operator != (const CCharacter
*object
) const
493 return !operator ==(object
);
496 /// Less then comparator : comparison on pointer object address
497 bool operator < (const CCharacterPtr
&other
) const
499 return _Ptr
< other
._Ptr
;
502 /// Used to walk thrue the linked list of pointer
503 CCharacterPtr
*getNextPtr()
515 friend class CRingUser
;
517 const char *_FileName
;
520 // linked list of smart ptr
521 CRingUserPtr
*_NextPtr
;
522 CRingUserPtr
*_PrevPtr
;
540 CRingUserPtr(const CRingUserPtr
&other
, const char *filename
, uint32 lineNum
)
541 : _FileName(filename
),
546 // point the same object
548 // insert the pointer in the list
552 CRingUserPtr(const CRingUserPtr
&other
)
553 : _FileName(other
._FileName
),
554 _LineNum(other
._LineNum
),
558 // point the same object
560 // insert the pointer in the list
564 CRingUserPtr(CRingUser
*objectPtr
, const char *filename
, uint32 lineNum
)
565 : _FileName(filename
),
575 CRingUserPtr
&assign(const CRingUserPtr
&other
, const char *filename
, uint32 lineNum
)
577 _FileName
= filename
;
592 CRingUserPtr
&assign(CRingUser
*objectPtr
, const char *filename
, uint32 lineNum
)
594 _FileName
= filename
;
604 CRingUserPtr
&operator =(const CRingUserPtr
&other
)
606 return assign(other
, __FILE__
, __LINE__
);
609 CRingUser
*operator ->()
613 const CRingUser
*operator ->() const
618 bool operator == (const CRingUserPtr
&other
) const
620 return _Ptr
== other
._Ptr
;
622 bool operator != (const CRingUserPtr
&other
) const
624 return !operator ==(other
);
627 bool operator == (const CRingUser
*object
) const
629 return _Ptr
== object
;
631 bool operator != (const CRingUser
*object
) const
633 return !operator ==(object
);
636 /// Less then comparator : comparison on pointer object address
637 bool operator < (const CRingUserPtr
&other
) const
639 return _Ptr
< other
._Ptr
;
642 /// Used to walk thrue the linked list of pointer
643 CRingUserPtr
*getNextPtr()
655 friend class CSession
;
657 const char *_FileName
;
660 // linked list of smart ptr
661 CSessionPtr
*_NextPtr
;
662 CSessionPtr
*_PrevPtr
;
680 CSessionPtr(const CSessionPtr
&other
, const char *filename
, uint32 lineNum
)
681 : _FileName(filename
),
686 // point the same object
688 // insert the pointer in the list
692 CSessionPtr(const CSessionPtr
&other
)
693 : _FileName(other
._FileName
),
694 _LineNum(other
._LineNum
),
698 // point the same object
700 // insert the pointer in the list
704 CSessionPtr(CSession
*objectPtr
, const char *filename
, uint32 lineNum
)
705 : _FileName(filename
),
715 CSessionPtr
&assign(const CSessionPtr
&other
, const char *filename
, uint32 lineNum
)
717 _FileName
= filename
;
732 CSessionPtr
&assign(CSession
*objectPtr
, const char *filename
, uint32 lineNum
)
734 _FileName
= filename
;
744 CSessionPtr
&operator =(const CSessionPtr
&other
)
746 return assign(other
, __FILE__
, __LINE__
);
749 CSession
*operator ->()
753 const CSession
*operator ->() const
758 bool operator == (const CSessionPtr
&other
) const
760 return _Ptr
== other
._Ptr
;
762 bool operator != (const CSessionPtr
&other
) const
764 return !operator ==(other
);
767 bool operator == (const CSession
*object
) const
769 return _Ptr
== object
;
771 bool operator != (const CSession
*object
) const
773 return !operator ==(object
);
776 /// Less then comparator : comparison on pointer object address
777 bool operator < (const CSessionPtr
&other
) const
779 return _Ptr
< other
._Ptr
;
782 /// Used to walk thrue the linked list of pointer
783 CSessionPtr
*getNextPtr()
797 const char *_FileName
;
800 // linked list of smart ptr
820 CShardPtr(const CShardPtr
&other
, const char *filename
, uint32 lineNum
)
821 : _FileName(filename
),
826 // point the same object
828 // insert the pointer in the list
832 CShardPtr(const CShardPtr
&other
)
833 : _FileName(other
._FileName
),
834 _LineNum(other
._LineNum
),
838 // point the same object
840 // insert the pointer in the list
844 CShardPtr(CShard
*objectPtr
, const char *filename
, uint32 lineNum
)
845 : _FileName(filename
),
855 CShardPtr
&assign(const CShardPtr
&other
, const char *filename
, uint32 lineNum
)
857 _FileName
= filename
;
872 CShardPtr
&assign(CShard
*objectPtr
, const char *filename
, uint32 lineNum
)
874 _FileName
= filename
;
884 CShardPtr
&operator =(const CShardPtr
&other
)
886 return assign(other
, __FILE__
, __LINE__
);
889 CShard
*operator ->()
893 const CShard
*operator ->() const
898 bool operator == (const CShardPtr
&other
) const
900 return _Ptr
== other
._Ptr
;
902 bool operator != (const CShardPtr
&other
) const
904 return !operator ==(other
);
907 bool operator == (const CShard
*object
) const
909 return _Ptr
== object
;
911 bool operator != (const CShard
*object
) const
913 return !operator ==(object
);
916 /// Less then comparator : comparison on pointer object address
917 bool operator < (const CShardPtr
&other
) const
919 return _Ptr
< other
._Ptr
;
922 /// Used to walk thrue the linked list of pointer
923 CShardPtr
*getNextPtr()
937 const char *_FileName
;
940 // linked list of smart ptr
960 CGuildPtr(const CGuildPtr
&other
, const char *filename
, uint32 lineNum
)
961 : _FileName(filename
),
966 // point the same object
968 // insert the pointer in the list
972 CGuildPtr(const CGuildPtr
&other
)
973 : _FileName(other
._FileName
),
974 _LineNum(other
._LineNum
),
978 // point the same object
980 // insert the pointer in the list
984 CGuildPtr(CGuild
*objectPtr
, const char *filename
, uint32 lineNum
)
985 : _FileName(filename
),
995 CGuildPtr
&assign(const CGuildPtr
&other
, const char *filename
, uint32 lineNum
)
997 _FileName
= filename
;
1012 CGuildPtr
&assign(CGuild
*objectPtr
, const char *filename
, uint32 lineNum
)
1014 _FileName
= filename
;
1024 CGuildPtr
&operator =(const CGuildPtr
&other
)
1026 return assign(other
, __FILE__
, __LINE__
);
1029 CGuild
*operator ->()
1033 const CGuild
*operator ->() const
1038 bool operator == (const CGuildPtr
&other
) const
1040 return _Ptr
== other
._Ptr
;
1042 bool operator != (const CGuildPtr
&other
) const
1044 return !operator ==(other
);
1047 bool operator == (const CGuild
*object
) const
1049 return _Ptr
== object
;
1051 bool operator != (const CGuild
*object
) const
1053 return !operator ==(object
);
1056 /// Less then comparator : comparison on pointer object address
1057 bool operator < (const CGuildPtr
&other
) const
1059 return _Ptr
< other
._Ptr
;
1062 /// Used to walk thrue the linked list of pointer
1063 CGuildPtr
*getNextPtr()
1073 class CGuildInvitePtr
1075 friend class CGuildInvite
;
1077 const char *_FileName
;
1080 // linked list of smart ptr
1081 CGuildInvitePtr
*_NextPtr
;
1082 CGuildInvitePtr
*_PrevPtr
;
1100 CGuildInvitePtr(const CGuildInvitePtr
&other
, const char *filename
, uint32 lineNum
)
1101 : _FileName(filename
),
1106 // point the same object
1108 // insert the pointer in the list
1112 CGuildInvitePtr(const CGuildInvitePtr
&other
)
1113 : _FileName(other
._FileName
),
1114 _LineNum(other
._LineNum
),
1118 // point the same object
1120 // insert the pointer in the list
1124 CGuildInvitePtr(CGuildInvite
*objectPtr
, const char *filename
, uint32 lineNum
)
1125 : _FileName(filename
),
1135 CGuildInvitePtr
&assign(const CGuildInvitePtr
&other
, const char *filename
, uint32 lineNum
)
1137 _FileName
= filename
;
1152 CGuildInvitePtr
&assign(CGuildInvite
*objectPtr
, const char *filename
, uint32 lineNum
)
1154 _FileName
= filename
;
1164 CGuildInvitePtr
&operator =(const CGuildInvitePtr
&other
)
1166 return assign(other
, __FILE__
, __LINE__
);
1169 CGuildInvite
*operator ->()
1173 const CGuildInvite
*operator ->() const
1178 bool operator == (const CGuildInvitePtr
&other
) const
1180 return _Ptr
== other
._Ptr
;
1182 bool operator != (const CGuildInvitePtr
&other
) const
1184 return !operator ==(other
);
1187 bool operator == (const CGuildInvite
*object
) const
1189 return _Ptr
== object
;
1191 bool operator != (const CGuildInvite
*object
) const
1193 return !operator ==(object
);
1196 /// Less then comparator : comparison on pointer object address
1197 bool operator < (const CGuildInvitePtr
&other
) const
1199 return _Ptr
< other
._Ptr
;
1202 /// Used to walk thrue the linked list of pointer
1203 CGuildInvitePtr
*getNextPtr()
1213 class CPlayerRatingPtr
1215 friend class CPlayerRating
;
1217 const char *_FileName
;
1220 // linked list of smart ptr
1221 CPlayerRatingPtr
*_NextPtr
;
1222 CPlayerRatingPtr
*_PrevPtr
;
1224 CPlayerRating
*_Ptr
;
1240 CPlayerRatingPtr(const CPlayerRatingPtr
&other
, const char *filename
, uint32 lineNum
)
1241 : _FileName(filename
),
1246 // point the same object
1248 // insert the pointer in the list
1252 CPlayerRatingPtr(const CPlayerRatingPtr
&other
)
1253 : _FileName(other
._FileName
),
1254 _LineNum(other
._LineNum
),
1258 // point the same object
1260 // insert the pointer in the list
1264 CPlayerRatingPtr(CPlayerRating
*objectPtr
, const char *filename
, uint32 lineNum
)
1265 : _FileName(filename
),
1275 CPlayerRatingPtr
&assign(const CPlayerRatingPtr
&other
, const char *filename
, uint32 lineNum
)
1277 _FileName
= filename
;
1292 CPlayerRatingPtr
&assign(CPlayerRating
*objectPtr
, const char *filename
, uint32 lineNum
)
1294 _FileName
= filename
;
1304 CPlayerRatingPtr
&operator =(const CPlayerRatingPtr
&other
)
1306 return assign(other
, __FILE__
, __LINE__
);
1309 CPlayerRating
*operator ->()
1313 const CPlayerRating
*operator ->() const
1318 bool operator == (const CPlayerRatingPtr
&other
) const
1320 return _Ptr
== other
._Ptr
;
1322 bool operator != (const CPlayerRatingPtr
&other
) const
1324 return !operator ==(other
);
1327 bool operator == (const CPlayerRating
*object
) const
1329 return _Ptr
== object
;
1331 bool operator != (const CPlayerRating
*object
) const
1333 return !operator ==(object
);
1336 /// Less then comparator : comparison on pointer object address
1337 bool operator < (const CPlayerRatingPtr
&other
) const
1339 return _Ptr
< other
._Ptr
;
1342 /// Used to walk thrue the linked list of pointer
1343 CPlayerRatingPtr
*getNextPtr()
1353 class CJournalEntryPtr
1355 friend class CJournalEntry
;
1357 const char *_FileName
;
1360 // linked list of smart ptr
1361 CJournalEntryPtr
*_NextPtr
;
1362 CJournalEntryPtr
*_PrevPtr
;
1364 CJournalEntry
*_Ptr
;
1380 CJournalEntryPtr(const CJournalEntryPtr
&other
, const char *filename
, uint32 lineNum
)
1381 : _FileName(filename
),
1386 // point the same object
1388 // insert the pointer in the list
1392 CJournalEntryPtr(const CJournalEntryPtr
&other
)
1393 : _FileName(other
._FileName
),
1394 _LineNum(other
._LineNum
),
1398 // point the same object
1400 // insert the pointer in the list
1404 CJournalEntryPtr(CJournalEntry
*objectPtr
, const char *filename
, uint32 lineNum
)
1405 : _FileName(filename
),
1415 CJournalEntryPtr
&assign(const CJournalEntryPtr
&other
, const char *filename
, uint32 lineNum
)
1417 _FileName
= filename
;
1432 CJournalEntryPtr
&assign(CJournalEntry
*objectPtr
, const char *filename
, uint32 lineNum
)
1434 _FileName
= filename
;
1444 CJournalEntryPtr
&operator =(const CJournalEntryPtr
&other
)
1446 return assign(other
, __FILE__
, __LINE__
);
1449 CJournalEntry
*operator ->()
1453 const CJournalEntry
*operator ->() const
1458 bool operator == (const CJournalEntryPtr
&other
) const
1460 return _Ptr
== other
._Ptr
;
1462 bool operator != (const CJournalEntryPtr
&other
) const
1464 return !operator ==(other
);
1467 bool operator == (const CJournalEntry
*object
) const
1469 return _Ptr
== object
;
1471 bool operator != (const CJournalEntry
*object
) const
1473 return !operator ==(object
);
1476 /// Less then comparator : comparison on pointer object address
1477 bool operator < (const CJournalEntryPtr
&other
) const
1479 return _Ptr
< other
._Ptr
;
1482 /// Used to walk thrue the linked list of pointer
1483 CJournalEntryPtr
*getNextPtr()
1495 friend class CFolder
;
1497 const char *_FileName
;
1500 // linked list of smart ptr
1501 CFolderPtr
*_NextPtr
;
1502 CFolderPtr
*_PrevPtr
;
1520 CFolderPtr(const CFolderPtr
&other
, const char *filename
, uint32 lineNum
)
1521 : _FileName(filename
),
1526 // point the same object
1528 // insert the pointer in the list
1532 CFolderPtr(const CFolderPtr
&other
)
1533 : _FileName(other
._FileName
),
1534 _LineNum(other
._LineNum
),
1538 // point the same object
1540 // insert the pointer in the list
1544 CFolderPtr(CFolder
*objectPtr
, const char *filename
, uint32 lineNum
)
1545 : _FileName(filename
),
1555 CFolderPtr
&assign(const CFolderPtr
&other
, const char *filename
, uint32 lineNum
)
1557 _FileName
= filename
;
1572 CFolderPtr
&assign(CFolder
*objectPtr
, const char *filename
, uint32 lineNum
)
1574 _FileName
= filename
;
1584 CFolderPtr
&operator =(const CFolderPtr
&other
)
1586 return assign(other
, __FILE__
, __LINE__
);
1589 CFolder
*operator ->()
1593 const CFolder
*operator ->() const
1598 bool operator == (const CFolderPtr
&other
) const
1600 return _Ptr
== other
._Ptr
;
1602 bool operator != (const CFolderPtr
&other
) const
1604 return !operator ==(other
);
1607 bool operator == (const CFolder
*object
) const
1609 return _Ptr
== object
;
1611 bool operator != (const CFolder
*object
) const
1613 return !operator ==(object
);
1616 /// Less then comparator : comparison on pointer object address
1617 bool operator < (const CFolderPtr
&other
) const
1619 return _Ptr
< other
._Ptr
;
1622 /// Used to walk thrue the linked list of pointer
1623 CFolderPtr
*getNextPtr()
1633 class CFolderAccessPtr
1635 friend class CFolderAccess
;
1637 const char *_FileName
;
1640 // linked list of smart ptr
1641 CFolderAccessPtr
*_NextPtr
;
1642 CFolderAccessPtr
*_PrevPtr
;
1644 CFolderAccess
*_Ptr
;
1660 CFolderAccessPtr(const CFolderAccessPtr
&other
, const char *filename
, uint32 lineNum
)
1661 : _FileName(filename
),
1666 // point the same object
1668 // insert the pointer in the list
1672 CFolderAccessPtr(const CFolderAccessPtr
&other
)
1673 : _FileName(other
._FileName
),
1674 _LineNum(other
._LineNum
),
1678 // point the same object
1680 // insert the pointer in the list
1684 CFolderAccessPtr(CFolderAccess
*objectPtr
, const char *filename
, uint32 lineNum
)
1685 : _FileName(filename
),
1695 CFolderAccessPtr
&assign(const CFolderAccessPtr
&other
, const char *filename
, uint32 lineNum
)
1697 _FileName
= filename
;
1712 CFolderAccessPtr
&assign(CFolderAccess
*objectPtr
, const char *filename
, uint32 lineNum
)
1714 _FileName
= filename
;
1724 CFolderAccessPtr
&operator =(const CFolderAccessPtr
&other
)
1726 return assign(other
, __FILE__
, __LINE__
);
1729 CFolderAccess
*operator ->()
1733 const CFolderAccess
*operator ->() const
1738 bool operator == (const CFolderAccessPtr
&other
) const
1740 return _Ptr
== other
._Ptr
;
1742 bool operator != (const CFolderAccessPtr
&other
) const
1744 return !operator ==(other
);
1747 bool operator == (const CFolderAccess
*object
) const
1749 return _Ptr
== object
;
1751 bool operator != (const CFolderAccess
*object
) const
1753 return !operator ==(object
);
1756 /// Less then comparator : comparison on pointer object address
1757 bool operator < (const CFolderAccessPtr
&other
) const
1759 return _Ptr
< other
._Ptr
;
1762 /// Used to walk thrue the linked list of pointer
1763 CFolderAccessPtr
*getNextPtr()
1775 friend class CScenario
;
1777 const char *_FileName
;
1780 // linked list of smart ptr
1781 CScenarioPtr
*_NextPtr
;
1782 CScenarioPtr
*_PrevPtr
;
1800 CScenarioPtr(const CScenarioPtr
&other
, const char *filename
, uint32 lineNum
)
1801 : _FileName(filename
),
1806 // point the same object
1808 // insert the pointer in the list
1812 CScenarioPtr(const CScenarioPtr
&other
)
1813 : _FileName(other
._FileName
),
1814 _LineNum(other
._LineNum
),
1818 // point the same object
1820 // insert the pointer in the list
1824 CScenarioPtr(CScenario
*objectPtr
, const char *filename
, uint32 lineNum
)
1825 : _FileName(filename
),
1835 CScenarioPtr
&assign(const CScenarioPtr
&other
, const char *filename
, uint32 lineNum
)
1837 _FileName
= filename
;
1852 CScenarioPtr
&assign(CScenario
*objectPtr
, const char *filename
, uint32 lineNum
)
1854 _FileName
= filename
;
1864 CScenarioPtr
&operator =(const CScenarioPtr
&other
)
1866 return assign(other
, __FILE__
, __LINE__
);
1869 CScenario
*operator ->()
1873 const CScenario
*operator ->() const
1878 bool operator == (const CScenarioPtr
&other
) const
1880 return _Ptr
== other
._Ptr
;
1882 bool operator != (const CScenarioPtr
&other
) const
1884 return !operator ==(other
);
1887 bool operator == (const CScenario
*object
) const
1889 return _Ptr
== object
;
1891 bool operator != (const CScenario
*object
) const
1893 return !operator ==(object
);
1896 /// Less then comparator : comparison on pointer object address
1897 bool operator < (const CScenarioPtr
&other
) const
1899 return _Ptr
< other
._Ptr
;
1902 /// Used to walk thrue the linked list of pointer
1903 CScenarioPtr
*getNextPtr()
1913 class CSessionLogPtr
1915 friend class CSessionLog
;
1917 const char *_FileName
;
1920 // linked list of smart ptr
1921 CSessionLogPtr
*_NextPtr
;
1922 CSessionLogPtr
*_PrevPtr
;
1940 CSessionLogPtr(const CSessionLogPtr
&other
, const char *filename
, uint32 lineNum
)
1941 : _FileName(filename
),
1946 // point the same object
1948 // insert the pointer in the list
1952 CSessionLogPtr(const CSessionLogPtr
&other
)
1953 : _FileName(other
._FileName
),
1954 _LineNum(other
._LineNum
),
1958 // point the same object
1960 // insert the pointer in the list
1964 CSessionLogPtr(CSessionLog
*objectPtr
, const char *filename
, uint32 lineNum
)
1965 : _FileName(filename
),
1975 CSessionLogPtr
&assign(const CSessionLogPtr
&other
, const char *filename
, uint32 lineNum
)
1977 _FileName
= filename
;
1992 CSessionLogPtr
&assign(CSessionLog
*objectPtr
, const char *filename
, uint32 lineNum
)
1994 _FileName
= filename
;
2004 CSessionLogPtr
&operator =(const CSessionLogPtr
&other
)
2006 return assign(other
, __FILE__
, __LINE__
);
2009 CSessionLog
*operator ->()
2013 const CSessionLog
*operator ->() const
2018 bool operator == (const CSessionLogPtr
&other
) const
2020 return _Ptr
== other
._Ptr
;
2022 bool operator != (const CSessionLogPtr
&other
) const
2024 return !operator ==(other
);
2027 bool operator == (const CSessionLog
*object
) const
2029 return _Ptr
== object
;
2031 bool operator != (const CSessionLog
*object
) const
2033 return !operator ==(object
);
2036 /// Less then comparator : comparison on pointer object address
2037 bool operator < (const CSessionLogPtr
&other
) const
2039 return _Ptr
< other
._Ptr
;
2042 /// Used to walk thrue the linked list of pointer
2043 CSessionLogPtr
*getNextPtr()
2055 friend class CGmStatus
;
2057 const char *_FileName
;
2060 // linked list of smart ptr
2061 CGmStatusPtr
*_NextPtr
;
2062 CGmStatusPtr
*_PrevPtr
;
2080 CGmStatusPtr(const CGmStatusPtr
&other
, const char *filename
, uint32 lineNum
)
2081 : _FileName(filename
),
2086 // point the same object
2088 // insert the pointer in the list
2092 CGmStatusPtr(const CGmStatusPtr
&other
)
2093 : _FileName(other
._FileName
),
2094 _LineNum(other
._LineNum
),
2098 // point the same object
2100 // insert the pointer in the list
2104 CGmStatusPtr(CGmStatus
*objectPtr
, const char *filename
, uint32 lineNum
)
2105 : _FileName(filename
),
2115 CGmStatusPtr
&assign(const CGmStatusPtr
&other
, const char *filename
, uint32 lineNum
)
2117 _FileName
= filename
;
2132 CGmStatusPtr
&assign(CGmStatus
*objectPtr
, const char *filename
, uint32 lineNum
)
2134 _FileName
= filename
;
2144 CGmStatusPtr
&operator =(const CGmStatusPtr
&other
)
2146 return assign(other
, __FILE__
, __LINE__
);
2149 CGmStatus
*operator ->()
2153 const CGmStatus
*operator ->() const
2158 bool operator == (const CGmStatusPtr
&other
) const
2160 return _Ptr
== other
._Ptr
;
2162 bool operator != (const CGmStatusPtr
&other
) const
2164 return !operator ==(other
);
2167 bool operator == (const CGmStatus
*object
) const
2169 return _Ptr
== object
;
2171 bool operator != (const CGmStatus
*object
) const
2173 return !operator ==(object
);
2176 /// Less then comparator : comparison on pointer object address
2177 bool operator < (const CGmStatusPtr
&other
) const
2179 return _Ptr
< other
._Ptr
;
2182 /// Used to walk thrue the linked list of pointer
2183 CGmStatusPtr
*getNextPtr()
2198 /// the highest valid value in the enum
2199 last_enum_item
= ut_pioneer
,
2200 /// a value equal to the last enum item +1
2205 /// Number of enumerated values
2209 /// Index table to convert enum value to linear index table
2210 const std::map
<TValues
, uint32
> &getIndexTable() const
2212 static std::map
<TValues
, uint32
> indexTable
;
2213 static bool init
= false;
2216 // fill the index table
2217 indexTable
.insert(std::make_pair(ut_character
, 0));
2218 indexTable
.insert(std::make_pair(ut_pioneer
, 1));
2227 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
2229 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
2230 NL_STRING_CONVERSION_TABLE_ENTRY(ut_character
)
2231 NL_STRING_CONVERSION_TABLE_ENTRY(ut_pioneer
)
2232 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
2234 static NLMISC::CStringConversion
<TValues
>
2235 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
2236 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
2238 return conversionTable
;
2245 : _Value(invalid_val
)
2248 TUserType(TValues value
)
2253 TUserType(const std::string
&str
)
2255 _Value
= getConversionTable().fromString(str
);
2258 void serial(NLMISC::IStream
&s
)
2260 s
.serialEnum(_Value
);
2263 bool operator == (const TUserType
&other
) const
2265 return _Value
== other
._Value
;
2267 bool operator != (const TUserType
&other
) const
2269 return ! (_Value
== other
._Value
);
2271 bool operator < (const TUserType
&other
) const
2273 return _Value
< other
._Value
;
2276 bool operator <= (const TUserType
&other
) const
2278 return _Value
<= other
._Value
;
2281 bool operator > (const TUserType
&other
) const
2283 return !(_Value
<= other
._Value
);
2285 bool operator >= (const TUserType
&other
) const
2287 return !(_Value
< other
._Value
);
2290 const std::string
&toString() const
2292 return getConversionTable().toString(_Value
);
2294 static const std::string
&toString(TValues value
)
2296 return getConversionTable().toString(value
);
2299 TValues
getValue() const
2304 // return true if the actual value of the enum is valid, otherwise false
2307 if (_Value
== invalid_val
)
2310 // not invalid, check other enum value
2311 return getConversionTable().isValid(_Value
);
2317 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
2318 nlassert(it
!= getIndexTable().end());
2325 struct TKnownUserRelation
2332 /// the highest valid value in the enum
2333 last_enum_item
= rt_friend_dm
,
2334 /// a value equal to the last enum item +1
2339 /// Number of enumerated values
2343 /// Index table to convert enum value to linear index table
2344 const std::map
<TValues
, uint32
> &getIndexTable() const
2346 static std::map
<TValues
, uint32
> indexTable
;
2347 static bool init
= false;
2350 // fill the index table
2351 indexTable
.insert(std::make_pair(rt_friend
, 0));
2352 indexTable
.insert(std::make_pair(rt_banned
, 1));
2353 indexTable
.insert(std::make_pair(rt_friend_dm
, 2));
2362 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
2364 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
2365 NL_STRING_CONVERSION_TABLE_ENTRY(rt_friend
)
2366 NL_STRING_CONVERSION_TABLE_ENTRY(rt_banned
)
2367 NL_STRING_CONVERSION_TABLE_ENTRY(rt_friend_dm
)
2368 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
2370 static NLMISC::CStringConversion
<TValues
>
2371 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
2372 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
2374 return conversionTable
;
2380 TKnownUserRelation()
2381 : _Value(invalid_val
)
2384 TKnownUserRelation(TValues value
)
2389 TKnownUserRelation(const std::string
&str
)
2391 _Value
= getConversionTable().fromString(str
);
2394 void serial(NLMISC::IStream
&s
)
2396 s
.serialEnum(_Value
);
2399 bool operator == (const TKnownUserRelation
&other
) const
2401 return _Value
== other
._Value
;
2403 bool operator != (const TKnownUserRelation
&other
) const
2405 return ! (_Value
== other
._Value
);
2407 bool operator < (const TKnownUserRelation
&other
) const
2409 return _Value
< other
._Value
;
2412 bool operator <= (const TKnownUserRelation
&other
) const
2414 return _Value
<= other
._Value
;
2417 bool operator > (const TKnownUserRelation
&other
) const
2419 return !(_Value
<= other
._Value
);
2421 bool operator >= (const TKnownUserRelation
&other
) const
2423 return !(_Value
< other
._Value
);
2426 const std::string
&toString() const
2428 return getConversionTable().toString(_Value
);
2430 static const std::string
&toString(TValues value
)
2432 return getConversionTable().toString(value
);
2435 TValues
getValue() const
2440 // return true if the actual value of the enum is valid, otherwise false
2443 if (_Value
== invalid_val
)
2446 // not invalid, check other enum value
2447 return getConversionTable().isValid(_Value
);
2453 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
2454 nlassert(it
!= getIndexTable().end());
2459 /////////////////////////////////////////////////////////////////
2460 // WARNING : this is a generated file, don't change it !
2461 /////////////////////////////////////////////////////////////////
2472 uint32 _TargetCharacter
;
2474 TKnownUserRelation _Relation
;
2476 std::string _Comments
;
2479 uint32
getOwnerId() const
2484 void setOwnerId(uint32 value
)
2487 if (_OwnerId
!= value
)
2489 if (getPersistentState() != NOPE::os_transient
)
2490 setPersistentState(NOPE::os_dirty
);
2498 uint32
getTargetUser() const
2503 void setTargetUser(uint32 value
)
2506 if (_TargetUser
!= value
)
2508 if (getPersistentState() != NOPE::os_transient
)
2509 setPersistentState(NOPE::os_dirty
);
2511 _TargetUser
= value
;
2517 uint32
getTargetCharacter() const
2519 return _TargetCharacter
;
2522 void setTargetCharacter(uint32 value
)
2525 if (_TargetCharacter
!= value
)
2527 if (getPersistentState() != NOPE::os_transient
)
2528 setPersistentState(NOPE::os_dirty
);
2530 _TargetCharacter
= value
;
2536 TKnownUserRelation
getRelation() const
2541 void setRelation(TKnownUserRelation value
)
2544 if (_Relation
!= value
)
2546 if (getPersistentState() != NOPE::os_transient
)
2547 setPersistentState(NOPE::os_dirty
);
2555 const std::string
&getComments() const
2562 void setComments(const std::string
&value
)
2565 if (_Comments
!= value
)
2567 if (getPersistentState() != NOPE::os_transient
)
2568 setPersistentState(NOPE::os_dirty
);
2578 bool operator == (const CKnownUser
&other
) const
2580 return _RelationId
== other
._RelationId
2581 && _OwnerId
== other
._OwnerId
2582 && _TargetUser
== other
._TargetUser
2583 && _TargetCharacter
== other
._TargetCharacter
2584 && _Relation
== other
._Relation
2585 && _Comments
== other
._Comments
;
2590 // private constructor, you must use 'createTransient' to get an instance
2593 _ObjectState(NOPE::os_transient
),
2594 _RelationId(NOPE::INVALID_OBJECT_ID
)
2597 // register the cache for this class (if not already done)
2598 registerUpdatable();
2601 // Destructor, delete any children
2604 /// utility func to remove this object from the released object container
2605 void removeFromReleased();
2609 /// Create a new instance in the transient space
2610 static CKnownUserPtr
createTransient(const char *filename
, uint32 lineNum
)
2612 return CKnownUserPtr(new CKnownUser(), filename
, lineNum
);
2615 /** Create a new object in the database from the current object data.
2616 * The object MUST be in transient state (i.e, it must be a new
2617 * object created by user and not comming from the databse).
2618 * If identifier is autogenerated, the generated id can be read after
2621 bool create(MSW::CConnection
&connection
);
2622 /** Update the database with the current object state.
2623 * The object MUST be either in clean or dirty state.
2624 * Return true if the object has been effectively stored
2626 * After this call, the object is in 'clean' state.
2628 bool update(MSW::CConnection
&connection
);
2629 /** Remove the current object from the persistent storage.
2630 * The object must be in clean or dirty state.
2631 * Return true if the object has been correctly
2632 * updated in the database.
2633 * After the call, the object is in 'clean' state.
2635 bool remove(MSW::CConnection
&connection
);
2636 /** Remove an object from the persistent storage by specifying
2638 * Return true if an entry as been effectively removed from
2640 * After the call, the object is in 'removed' state and should
2641 * no more be used. A good pratice should be to delete
2642 * the transient object just after the remove call.
2644 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
2646 /** Load an instance from the database.
2647 * This call allocate a new object and load the property value
2648 * from the database.
2649 * Return NULL if the object id is not found.
2651 static CKnownUserPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
2654 /** Load all objects children of CRingUser and
2655 * return them by using the specified output iterator.
2658 static bool loadChildrenOfCRingUser(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CKnownUserPtr
> &children
, const char *filename
, uint32 lineNum
);
2660 /** Load all objects children of CCharacter and
2661 * return them by using the specified output iterator.
2664 static bool loadChildrenOfCCharacter(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CKnownUserPtr
> &children
, const char *filename
, uint32 lineNum
);
2670 friend class CPersistentCache
;
2671 friend class CKnownUserPtr
;
2673 typedef std::map
<uint32
, CKnownUser
*> TObjectCache
;
2674 typedef std::set
<CKnownUser
*> TObjectSet
;
2675 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
2677 /// The complete set of object currently in memory (either active or released) excluding transient instance
2678 static TObjectCache _ObjectCache
;
2679 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
2680 static TReleasedObject _ReleasedObject
;
2682 /// The current object state
2683 NOPE::TObjectState _ObjectState
;
2685 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
2686 time_t _ReleaseDate
;
2688 /// The linked list of pointer on this object
2689 CKnownUserPtr
*_PtrList
;
2691 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
2692 static CKnownUser
*loadFromCache(uint32 objectId
, bool unrelease
);
2694 // Receive and execute command from the cache manager.
2695 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
2699 static void updateCache();
2702 static void clearCache();
2704 void registerUpdatable();
2706 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
2707 void setFirstPtr(CKnownUserPtr
*ptr
);
2709 // return the first pointer of the pointer list (can be null)
2710 CKnownUserPtr
*getFirstPtr()
2717 /** Return the object identifier (witch is unique)
2718 * You can only call this method on a persistent instance.
2719 * (because transient instance can have invalid id)
2721 uint32
getObjectId() const
2724 nlassert(getPersistentState() != NOPE::os_transient
);
2728 /** Set the object unique ID.
2729 * You can only set the object id on a transient object
2730 * having a non autogenerated unique id.
2731 * Furthermore, you MUST set the id before calling create()
2732 * if the id is not autogenerated.
2734 void setObjectId(uint32 objectId
)
2736 // can only be set when in transient state
2737 nlassert(getPersistentState() == NOPE::os_transient
);
2738 // can only be set once
2739 nlassert(_RelationId
== NOPE::INVALID_OBJECT_ID
);
2740 _RelationId
= objectId
;
2743 /** Return the current persistent state of the object.*/
2744 NOPE::TObjectState
getPersistentState() const
2746 return _ObjectState
;
2750 // Set the persistent state of the object and do some house keeping
2751 void setPersistentState(NOPE::TObjectState state
);
2758 /////////////////////////////////////////////////////////////////
2759 // WARNING : this is a generated file, don't change it !
2760 /////////////////////////////////////////////////////////////////
2761 class CSessionParticipant
2767 TSessionId _SessionId
;
2771 TSessionPartStatus _Status
;
2776 TSessionId
getSessionId() const
2781 void setSessionId(TSessionId value
)
2784 if (_SessionId
!= value
)
2786 if (getPersistentState() != NOPE::os_transient
)
2787 setPersistentState(NOPE::os_dirty
);
2795 uint32
getCharId() const
2800 void setCharId(uint32 value
)
2803 if (_CharId
!= value
)
2805 if (getPersistentState() != NOPE::os_transient
)
2806 setPersistentState(NOPE::os_dirty
);
2814 TSessionPartStatus
getStatus() const
2819 void setStatus(TSessionPartStatus value
)
2822 if (_Status
!= value
)
2824 if (getPersistentState() != NOPE::os_transient
)
2825 setPersistentState(NOPE::os_dirty
);
2833 bool getKicked() const
2838 void setKicked(bool value
)
2841 if (_Kicked
!= value
)
2843 if (getPersistentState() != NOPE::os_transient
)
2844 setPersistentState(NOPE::os_dirty
);
2852 bool operator == (const CSessionParticipant
&other
) const
2854 return _Id
== other
._Id
2855 && _SessionId
== other
._SessionId
2856 && _CharId
== other
._CharId
2857 && _Status
== other
._Status
2858 && _Kicked
== other
._Kicked
;
2863 // private constructor, you must use 'createTransient' to get an instance
2864 CSessionParticipant()
2866 _ObjectState(NOPE::os_transient
),
2867 _Id(NOPE::INVALID_OBJECT_ID
)
2869 // Default initialisation
2872 // register the cache for this class (if not already done)
2873 registerUpdatable();
2876 // Destructor, delete any children
2877 ~CSessionParticipant();
2879 /// utility func to remove this object from the released object container
2880 void removeFromReleased();
2884 /// Create a new instance in the transient space
2885 static CSessionParticipantPtr
createTransient(const char *filename
, uint32 lineNum
)
2887 return CSessionParticipantPtr(new CSessionParticipant(), filename
, lineNum
);
2890 /** Create a new object in the database from the current object data.
2891 * The object MUST be in transient state (i.e, it must be a new
2892 * object created by user and not comming from the databse).
2893 * If identifier is autogenerated, the generated id can be read after
2896 bool create(MSW::CConnection
&connection
);
2897 /** Update the database with the current object state.
2898 * The object MUST be either in clean or dirty state.
2899 * Return true if the object has been effectively stored
2901 * After this call, the object is in 'clean' state.
2903 bool update(MSW::CConnection
&connection
);
2904 /** Remove the current object from the persistent storage.
2905 * The object must be in clean or dirty state.
2906 * Return true if the object has been correctly
2907 * updated in the database.
2908 * After the call, the object is in 'clean' state.
2910 bool remove(MSW::CConnection
&connection
);
2911 /** Remove an object from the persistent storage by specifying
2913 * Return true if an entry as been effectively removed from
2915 * After the call, the object is in 'removed' state and should
2916 * no more be used. A good pratice should be to delete
2917 * the transient object just after the remove call.
2919 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
2921 /** Load an instance from the database.
2922 * This call allocate a new object and load the property value
2923 * from the database.
2924 * Return NULL if the object id is not found.
2926 static CSessionParticipantPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
2929 /** Load all objects children of CCharacter and
2930 * return them by using the specified output iterator.
2933 static bool loadChildrenOfCCharacter(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CSessionParticipantPtr
> &children
, const char *filename
, uint32 lineNum
);
2935 /** Load all objects children of CSession and
2936 * return them by using the specified output iterator.
2939 static bool loadChildrenOfCSession(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CSessionParticipantPtr
> &children
, const char *filename
, uint32 lineNum
);
2945 friend class CPersistentCache
;
2946 friend class CSessionParticipantPtr
;
2948 typedef std::map
<uint32
, CSessionParticipant
*> TObjectCache
;
2949 typedef std::set
<CSessionParticipant
*> TObjectSet
;
2950 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
2952 /// The complete set of object currently in memory (either active or released) excluding transient instance
2953 static TObjectCache _ObjectCache
;
2954 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
2955 static TReleasedObject _ReleasedObject
;
2957 /// The current object state
2958 NOPE::TObjectState _ObjectState
;
2960 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
2961 time_t _ReleaseDate
;
2963 /// The linked list of pointer on this object
2964 CSessionParticipantPtr
*_PtrList
;
2966 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
2967 static CSessionParticipant
*loadFromCache(uint32 objectId
, bool unrelease
);
2969 // Receive and execute command from the cache manager.
2970 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
2974 static void updateCache();
2977 static void clearCache();
2979 void registerUpdatable();
2981 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
2982 void setFirstPtr(CSessionParticipantPtr
*ptr
);
2984 // return the first pointer of the pointer list (can be null)
2985 CSessionParticipantPtr
*getFirstPtr()
2992 /** Return the object identifier (witch is unique)
2993 * You can only call this method on a persistent instance.
2994 * (because transient instance can have invalid id)
2996 uint32
getObjectId() const
2999 nlassert(getPersistentState() != NOPE::os_transient
);
3003 /** Set the object unique ID.
3004 * You can only set the object id on a transient object
3005 * having a non autogenerated unique id.
3006 * Furthermore, you MUST set the id before calling create()
3007 * if the id is not autogenerated.
3009 void setObjectId(uint32 objectId
)
3011 // can only be set when in transient state
3012 nlassert(getPersistentState() == NOPE::os_transient
);
3013 // can only be set once
3014 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
3018 /** Return the current persistent state of the object.*/
3019 NOPE::TObjectState
getPersistentState() const
3021 return _ObjectState
;
3025 // Set the persistent state of the object and do some house keeping
3026 void setPersistentState(NOPE::TObjectState state
);
3033 /////////////////////////////////////////////////////////////////
3034 // WARNING : this is a generated file, don't change it !
3035 /////////////////////////////////////////////////////////////////
3042 std::string _CharName
;
3048 uint32 _BestCombatLevel
;
3050 uint32 _HomeMainlandSessionId
;
3052 std::string _RingAccess
;
3054 CHARSYNC::TRace _Race
;
3056 CHARSYNC::TCivilisation _Civilisation
;
3058 CHARSYNC::TCult _Cult
;
3060 uint32 _CurrentSession
;
3064 uint32 _RRPMasterless
;
3070 uint32 _CreationDate
;
3072 uint32 _LastPlayedDate
;
3074 friend class CSession
;
3076 std::vector
< CSessionPtr
> *_Sessions
;
3078 friend class CSessionParticipant
;
3080 std::vector
< CSessionParticipantPtr
> *_SessionParticipants
;
3082 friend class CKnownUser
;
3084 std::vector
< CKnownUserPtr
> *_KnownBy
;
3086 friend class CPlayerRating
;
3088 std::vector
< CPlayerRatingPtr
> *_PlayerRatings
;
3091 const std::string
&getCharName() const
3098 void setCharName(const std::string
&value
)
3101 if (_CharName
!= value
)
3103 if (getPersistentState() != NOPE::os_transient
)
3104 setPersistentState(NOPE::os_dirty
);
3114 uint32
getUserId() const
3119 void setUserId(uint32 value
)
3122 if (_UserId
!= value
)
3124 if (getPersistentState() != NOPE::os_transient
)
3125 setPersistentState(NOPE::os_dirty
);
3133 uint32
getGuildId() const
3138 void setGuildId(uint32 value
)
3141 if (_GuildId
!= value
)
3143 if (getPersistentState() != NOPE::os_transient
)
3144 setPersistentState(NOPE::os_dirty
);
3152 uint32
getBestCombatLevel() const
3154 return _BestCombatLevel
;
3157 void setBestCombatLevel(uint32 value
)
3160 if (_BestCombatLevel
!= value
)
3162 if (getPersistentState() != NOPE::os_transient
)
3163 setPersistentState(NOPE::os_dirty
);
3165 _BestCombatLevel
= value
;
3171 uint32
getHomeMainlandSessionId() const
3173 return _HomeMainlandSessionId
;
3176 void setHomeMainlandSessionId(uint32 value
)
3179 if (_HomeMainlandSessionId
!= value
)
3181 if (getPersistentState() != NOPE::os_transient
)
3182 setPersistentState(NOPE::os_dirty
);
3184 _HomeMainlandSessionId
= value
;
3190 const std::string
&getRingAccess() const
3197 void setRingAccess(const std::string
&value
)
3200 if (_RingAccess
!= value
)
3202 if (getPersistentState() != NOPE::os_transient
)
3203 setPersistentState(NOPE::os_dirty
);
3206 _RingAccess
= value
;
3213 CHARSYNC::TRace
getRace() const
3218 void setRace(CHARSYNC::TRace value
)
3223 if (getPersistentState() != NOPE::os_transient
)
3224 setPersistentState(NOPE::os_dirty
);
3232 CHARSYNC::TCivilisation
getCivilisation() const
3234 return _Civilisation
;
3237 void setCivilisation(CHARSYNC::TCivilisation value
)
3240 if (_Civilisation
!= value
)
3242 if (getPersistentState() != NOPE::os_transient
)
3243 setPersistentState(NOPE::os_dirty
);
3245 _Civilisation
= value
;
3251 CHARSYNC::TCult
getCult() const
3256 void setCult(CHARSYNC::TCult value
)
3261 if (getPersistentState() != NOPE::os_transient
)
3262 setPersistentState(NOPE::os_dirty
);
3270 uint32
getCurrentSession() const
3272 return _CurrentSession
;
3275 void setCurrentSession(uint32 value
)
3278 if (_CurrentSession
!= value
)
3280 if (getPersistentState() != NOPE::os_transient
)
3281 setPersistentState(NOPE::os_dirty
);
3283 _CurrentSession
= value
;
3289 uint32
getRRPAM() const
3294 void setRRPAM(uint32 value
)
3297 if (_RRPAM
!= value
)
3299 if (getPersistentState() != NOPE::os_transient
)
3300 setPersistentState(NOPE::os_dirty
);
3308 uint32
getRRPMasterless() const
3310 return _RRPMasterless
;
3313 void setRRPMasterless(uint32 value
)
3316 if (_RRPMasterless
!= value
)
3318 if (getPersistentState() != NOPE::os_transient
)
3319 setPersistentState(NOPE::os_dirty
);
3321 _RRPMasterless
= value
;
3327 uint32
getRRPAuthor() const
3332 void setRRPAuthor(uint32 value
)
3335 if (_RRPAuthor
!= value
)
3337 if (getPersistentState() != NOPE::os_transient
)
3338 setPersistentState(NOPE::os_dirty
);
3346 bool getNewcomer() const
3351 void setNewcomer(bool value
)
3354 if (_Newcomer
!= value
)
3356 if (getPersistentState() != NOPE::os_transient
)
3357 setPersistentState(NOPE::os_dirty
);
3365 uint32
getCreationDate() const
3367 return _CreationDate
;
3370 void setCreationDate(uint32 value
)
3373 if (_CreationDate
!= value
)
3375 if (getPersistentState() != NOPE::os_transient
)
3376 setPersistentState(NOPE::os_dirty
);
3378 _CreationDate
= value
;
3384 uint32
getLastPlayedDate() const
3386 return _LastPlayedDate
;
3389 void setLastPlayedDate(uint32 value
)
3392 if (_LastPlayedDate
!= value
)
3394 if (getPersistentState() != NOPE::os_transient
)
3395 setPersistentState(NOPE::os_dirty
);
3397 _LastPlayedDate
= value
;
3403 /** Return a const reference to the vector of child.
3404 * If you want to modify the element inside, you need to
3405 * use on of the two following methods who return non const pointer
3406 * on contained elements.
3408 const std::vector
<CSessionPtr
> &getSessions() const;
3409 /** Return the ith element of the child vector
3410 * index must be valid (ie less than size of the vector)
3412 CSessionPtr
&getSessionsByIndex(uint32 index
) const;
3413 /** Return the identified element by looking in the vector
3414 * If no element match the id, NULL pointer is returned
3416 CSessionPtr
&getSessionsById(uint32 id
) const;
3419 /** Return a const reference to the vector of child.
3420 * If you want to modify the element inside, you need to
3421 * use on of the two following methods who return non const pointer
3422 * on contained elements.
3424 const std::vector
<CSessionParticipantPtr
> &getSessionParticipants() const;
3425 /** Return the ith element of the child vector
3426 * index must be valid (ie less than size of the vector)
3428 CSessionParticipantPtr
&getSessionParticipantsByIndex(uint32 index
) const;
3429 /** Return the identified element by looking in the vector
3430 * If no element match the id, NULL pointer is returned
3432 CSessionParticipantPtr
&getSessionParticipantsById(uint32 id
) const;
3435 /** Return a const reference to the vector of child.
3436 * If you want to modify the element inside, you need to
3437 * use on of the two following methods who return non const pointer
3438 * on contained elements.
3440 const std::vector
<CKnownUserPtr
> &getKnownBy() const;
3441 /** Return the ith element of the child vector
3442 * index must be valid (ie less than size of the vector)
3444 CKnownUserPtr
&getKnownByByIndex(uint32 index
) const;
3445 /** Return the identified element by looking in the vector
3446 * If no element match the id, NULL pointer is returned
3448 CKnownUserPtr
&getKnownByById(uint32 id
) const;
3451 /** Return a const reference to the vector of child.
3452 * If you want to modify the element inside, you need to
3453 * use on of the two following methods who return non const pointer
3454 * on contained elements.
3456 const std::vector
<CPlayerRatingPtr
> &getPlayerRatings() const;
3457 /** Return the ith element of the child vector
3458 * index must be valid (ie less than size of the vector)
3460 CPlayerRatingPtr
&getPlayerRatingsByIndex(uint32 index
) const;
3461 /** Return the identified element by looking in the vector
3462 * If no element match the id, NULL pointer is returned
3464 CPlayerRatingPtr
&getPlayerRatingsById(uint32 id
) const;
3467 bool operator == (const CCharacter
&other
) const
3469 return _CharId
== other
._CharId
3470 && _CharName
== other
._CharName
3471 && _UserId
== other
._UserId
3472 && _GuildId
== other
._GuildId
3473 && _BestCombatLevel
== other
._BestCombatLevel
3474 && _HomeMainlandSessionId
== other
._HomeMainlandSessionId
3475 && _RingAccess
== other
._RingAccess
3476 && _Race
== other
._Race
3477 && _Civilisation
== other
._Civilisation
3478 && _Cult
== other
._Cult
3479 && _CurrentSession
== other
._CurrentSession
3480 && _RRPAM
== other
._RRPAM
3481 && _RRPMasterless
== other
._RRPMasterless
3482 && _RRPAuthor
== other
._RRPAuthor
3483 && _Newcomer
== other
._Newcomer
3484 && _CreationDate
== other
._CreationDate
3485 && _LastPlayedDate
== other
._LastPlayedDate
;
3490 // private constructor, you must use 'createTransient' to get an instance
3493 _ObjectState(NOPE::os_transient
),
3494 _CharId(NOPE::INVALID_OBJECT_ID
)
3496 // Default initialisation
3498 _BestCombatLevel
= 0;
3499 _HomeMainlandSessionId
= 0;
3500 _CurrentSession
= 0;
3505 _LastPlayedDate
= 0;
3507 _SessionParticipants
= NULL
;
3509 _PlayerRatings
= NULL
;
3511 // register the cache for this class (if not already done)
3512 registerUpdatable();
3515 // Destructor, delete any children
3518 /// utility func to remove this object from the released object container
3519 void removeFromReleased();
3523 /// Create a new instance in the transient space
3524 static CCharacterPtr
createTransient(const char *filename
, uint32 lineNum
)
3526 return CCharacterPtr(new CCharacter(), filename
, lineNum
);
3529 /** Create a new object in the database from the current object data.
3530 * The object MUST be in transient state (i.e, it must be a new
3531 * object created by user and not comming from the databse).
3532 * If identifier is autogenerated, the generated id can be read after
3535 bool create(MSW::CConnection
&connection
);
3536 /** Update the database with the current object state.
3537 * The object MUST be either in clean or dirty state.
3538 * Return true if the object has been effectively stored
3540 * After this call, the object is in 'clean' state.
3542 bool update(MSW::CConnection
&connection
);
3543 /** Remove the current object from the persistent storage.
3544 * The object must be in clean or dirty state.
3545 * Return true if the object has been correctly
3546 * updated in the database.
3547 * After the call, the object is in 'clean' state.
3549 bool remove(MSW::CConnection
&connection
);
3550 /** Remove an object from the persistent storage by specifying
3552 * Return true if an entry as been effectively removed from
3554 * After the call, the object is in 'removed' state and should
3555 * no more be used. A good pratice should be to delete
3556 * the transient object just after the remove call.
3558 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
3560 /** Load an instance from the database.
3561 * This call allocate a new object and load the property value
3562 * from the database.
3563 * Return NULL if the object id is not found.
3565 static CCharacterPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
3568 /** Load all objects children of CRingUser and
3569 * return them by using the specified output iterator.
3572 static bool loadChildrenOfCRingUser(MSW::CConnection
&connection
, uint32 parentId
, std::map
< uint32
, CCharacterPtr
> &children
, const char *filename
, uint32 lineNum
);
3574 /** Load all objects children of CGuild and
3575 * return them by using the specified output iterator.
3578 static bool loadChildrenOfCGuild(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CCharacterPtr
> &children
, const char *filename
, uint32 lineNum
);
3580 /// Load Sessions child(ren) object(s).
3581 bool loadSessions(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
3583 /// Load SessionParticipants child(ren) object(s).
3584 bool loadSessionParticipants(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
3586 /// Load KnownBy child(ren) object(s).
3587 bool loadKnownBy(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
3589 /// Load PlayerRatings child(ren) object(s).
3590 bool loadPlayerRatings(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
3596 friend class CPersistentCache
;
3597 friend class CCharacterPtr
;
3599 typedef std::map
<uint32
, CCharacter
*> TObjectCache
;
3600 typedef std::set
<CCharacter
*> TObjectSet
;
3601 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
3603 /// The complete set of object currently in memory (either active or released) excluding transient instance
3604 static TObjectCache _ObjectCache
;
3605 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
3606 static TReleasedObject _ReleasedObject
;
3608 /// The current object state
3609 NOPE::TObjectState _ObjectState
;
3611 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
3612 time_t _ReleaseDate
;
3614 /// The linked list of pointer on this object
3615 CCharacterPtr
*_PtrList
;
3617 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
3618 static CCharacter
*loadFromCache(uint32 objectId
, bool unrelease
);
3620 // Receive and execute command from the cache manager.
3621 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
3625 static void updateCache();
3628 static void clearCache();
3630 void registerUpdatable();
3632 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
3633 void setFirstPtr(CCharacterPtr
*ptr
);
3635 // return the first pointer of the pointer list (can be null)
3636 CCharacterPtr
*getFirstPtr()
3643 /** Return the object identifier (witch is unique)
3644 * You can only call this method on a persistent instance.
3645 * (because transient instance can have invalid id)
3647 uint32
getObjectId() const
3653 /** Set the object unique ID.
3654 * You can only set the object id on a transient object
3655 * having a non autogenerated unique id.
3656 * Furthermore, you MUST set the id before calling create()
3657 * if the id is not autogenerated.
3659 void setObjectId(uint32 objectId
)
3661 // can only be set when in transient state
3662 nlassert(getPersistentState() == NOPE::os_transient
);
3663 // can only be set once
3664 nlassert(_CharId
== NOPE::INVALID_OBJECT_ID
);
3668 /** Return the current persistent state of the object.*/
3669 NOPE::TObjectState
getPersistentState() const
3671 return _ObjectState
;
3675 // Set the persistent state of the object and do some house keeping
3676 void setPersistentState(NOPE::TObjectState state
);
3685 struct TCurrentActivity
3693 /// the highest valid value in the enum
3694 last_enum_item
= ca_anim
,
3695 /// a value equal to the last enum item +1
3700 /// Number of enumerated values
3704 /// Index table to convert enum value to linear index table
3705 const std::map
<TValues
, uint32
> &getIndexTable() const
3707 static std::map
<TValues
, uint32
> indexTable
;
3708 static bool init
= false;
3711 // fill the index table
3712 indexTable
.insert(std::make_pair(ca_none
, 0));
3713 indexTable
.insert(std::make_pair(ca_play
, 1));
3714 indexTable
.insert(std::make_pair(ca_edit
, 2));
3715 indexTable
.insert(std::make_pair(ca_anim
, 3));
3724 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
3726 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
3727 NL_STRING_CONVERSION_TABLE_ENTRY(ca_none
)
3728 NL_STRING_CONVERSION_TABLE_ENTRY(ca_play
)
3729 NL_STRING_CONVERSION_TABLE_ENTRY(ca_edit
)
3730 NL_STRING_CONVERSION_TABLE_ENTRY(ca_anim
)
3731 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
3733 static NLMISC::CStringConversion
<TValues
>
3734 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
3735 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
3737 return conversionTable
;
3744 : _Value(invalid_val
)
3747 TCurrentActivity(TValues value
)
3752 TCurrentActivity(const std::string
&str
)
3754 _Value
= getConversionTable().fromString(str
);
3757 void serial(NLMISC::IStream
&s
)
3759 s
.serialEnum(_Value
);
3762 bool operator == (const TCurrentActivity
&other
) const
3764 return _Value
== other
._Value
;
3766 bool operator != (const TCurrentActivity
&other
) const
3768 return ! (_Value
== other
._Value
);
3770 bool operator < (const TCurrentActivity
&other
) const
3772 return _Value
< other
._Value
;
3775 bool operator <= (const TCurrentActivity
&other
) const
3777 return _Value
<= other
._Value
;
3780 bool operator > (const TCurrentActivity
&other
) const
3782 return !(_Value
<= other
._Value
);
3784 bool operator >= (const TCurrentActivity
&other
) const
3786 return !(_Value
< other
._Value
);
3789 const std::string
&toString() const
3791 return getConversionTable().toString(_Value
);
3793 static const std::string
&toString(TValues value
)
3795 return getConversionTable().toString(value
);
3798 TValues
getValue() const
3803 // return true if the actual value of the enum is valid, otherwise false
3806 if (_Value
== invalid_val
)
3809 // not invalid, check other enum value
3810 return getConversionTable().isValid(_Value
);
3816 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
3817 nlassert(it
!= getIndexTable().end());
3824 struct TCurrentStatus
3831 /// the highest valid value in the enum
3832 last_enum_item
= cs_online
,
3833 /// a value equal to the last enum item +1
3838 /// Number of enumerated values
3842 /// Index table to convert enum value to linear index table
3843 const std::map
<TValues
, uint32
> &getIndexTable() const
3845 static std::map
<TValues
, uint32
> indexTable
;
3846 static bool init
= false;
3849 // fill the index table
3850 indexTable
.insert(std::make_pair(cs_offline
, 0));
3851 indexTable
.insert(std::make_pair(cs_logged
, 1));
3852 indexTable
.insert(std::make_pair(cs_online
, 2));
3861 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
3863 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
3864 NL_STRING_CONVERSION_TABLE_ENTRY(cs_offline
)
3865 NL_STRING_CONVERSION_TABLE_ENTRY(cs_logged
)
3866 NL_STRING_CONVERSION_TABLE_ENTRY(cs_online
)
3867 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
3869 static NLMISC::CStringConversion
<TValues
>
3870 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
3871 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
3873 return conversionTable
;
3880 : _Value(invalid_val
)
3883 TCurrentStatus(TValues value
)
3888 TCurrentStatus(const std::string
&str
)
3890 _Value
= getConversionTable().fromString(str
);
3893 void serial(NLMISC::IStream
&s
)
3895 s
.serialEnum(_Value
);
3898 bool operator == (const TCurrentStatus
&other
) const
3900 return _Value
== other
._Value
;
3902 bool operator != (const TCurrentStatus
&other
) const
3904 return ! (_Value
== other
._Value
);
3906 bool operator < (const TCurrentStatus
&other
) const
3908 return _Value
< other
._Value
;
3911 bool operator <= (const TCurrentStatus
&other
) const
3913 return _Value
<= other
._Value
;
3916 bool operator > (const TCurrentStatus
&other
) const
3918 return !(_Value
<= other
._Value
);
3920 bool operator >= (const TCurrentStatus
&other
) const
3922 return !(_Value
< other
._Value
);
3925 const std::string
&toString() const
3927 return getConversionTable().toString(_Value
);
3929 static const std::string
&toString(TValues value
)
3931 return getConversionTable().toString(value
);
3934 TValues
getValue() const
3939 // return true if the actual value of the enum is valid, otherwise false
3942 if (_Value
== invalid_val
)
3945 // not invalid, check other enum value
3946 return getConversionTable().isValid(_Value
);
3952 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
3953 nlassert(it
!= getIndexTable().end());
3966 /// the highest valid value in the enum
3967 last_enum_item
= ul_public
,
3968 /// a value equal to the last enum item +1
3973 /// Number of enumerated values
3977 /// Index table to convert enum value to linear index table
3978 const std::map
<TValues
, uint32
> &getIndexTable() const
3980 static std::map
<TValues
, uint32
> indexTable
;
3981 static bool init
= false;
3984 // fill the index table
3985 indexTable
.insert(std::make_pair(ul_none
, 0));
3986 indexTable
.insert(std::make_pair(ul_public
, 1));
3995 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
3997 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
3998 NL_STRING_CONVERSION_TABLE_ENTRY(ul_none
)
3999 NL_STRING_CONVERSION_TABLE_ENTRY(ul_public
)
4000 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
4002 static NLMISC::CStringConversion
<TValues
>
4003 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
4004 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
4006 return conversionTable
;
4013 : _Value(invalid_val
)
4016 TPublicLevel(TValues value
)
4021 TPublicLevel(const std::string
&str
)
4023 _Value
= getConversionTable().fromString(str
);
4026 void serial(NLMISC::IStream
&s
)
4028 s
.serialEnum(_Value
);
4031 bool operator == (const TPublicLevel
&other
) const
4033 return _Value
== other
._Value
;
4035 bool operator != (const TPublicLevel
&other
) const
4037 return ! (_Value
== other
._Value
);
4039 bool operator < (const TPublicLevel
&other
) const
4041 return _Value
< other
._Value
;
4044 bool operator <= (const TPublicLevel
&other
) const
4046 return _Value
<= other
._Value
;
4049 bool operator > (const TPublicLevel
&other
) const
4051 return !(_Value
<= other
._Value
);
4053 bool operator >= (const TPublicLevel
&other
) const
4055 return !(_Value
< other
._Value
);
4058 const std::string
&toString() const
4060 return getConversionTable().toString(_Value
);
4062 static const std::string
&toString(TValues value
)
4064 return getConversionTable().toString(value
);
4067 TValues
getValue() const
4072 // return true if the actual value of the enum is valid, otherwise false
4075 if (_Value
== invalid_val
)
4078 // not invalid, check other enum value
4079 return getConversionTable().isValid(_Value
);
4085 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
4086 nlassert(it
!= getIndexTable().end());
4099 /// the highest valid value in the enum
4100 last_enum_item
= at_gold
,
4101 /// a value equal to the last enum item +1
4106 /// Number of enumerated values
4110 /// Index table to convert enum value to linear index table
4111 const std::map
<TValues
, uint32
> &getIndexTable() const
4113 static std::map
<TValues
, uint32
> indexTable
;
4114 static bool init
= false;
4117 // fill the index table
4118 indexTable
.insert(std::make_pair(at_normal
, 0));
4119 indexTable
.insert(std::make_pair(at_gold
, 1));
4128 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
4130 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
4131 NL_STRING_CONVERSION_TABLE_ENTRY(at_normal
)
4132 NL_STRING_CONVERSION_TABLE_ENTRY(at_gold
)
4133 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
4135 static NLMISC::CStringConversion
<TValues
>
4136 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
4137 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
4139 return conversionTable
;
4146 : _Value(invalid_val
)
4149 TAccountType(TValues value
)
4154 TAccountType(const std::string
&str
)
4156 _Value
= getConversionTable().fromString(str
);
4159 void serial(NLMISC::IStream
&s
)
4161 s
.serialEnum(_Value
);
4164 bool operator == (const TAccountType
&other
) const
4166 return _Value
== other
._Value
;
4168 bool operator != (const TAccountType
&other
) const
4170 return ! (_Value
== other
._Value
);
4172 bool operator < (const TAccountType
&other
) const
4174 return _Value
< other
._Value
;
4177 bool operator <= (const TAccountType
&other
) const
4179 return _Value
<= other
._Value
;
4182 bool operator > (const TAccountType
&other
) const
4184 return !(_Value
<= other
._Value
);
4186 bool operator >= (const TAccountType
&other
) const
4188 return !(_Value
< other
._Value
);
4191 const std::string
&toString() const
4193 return getConversionTable().toString(_Value
);
4195 static const std::string
&toString(TValues value
)
4197 return getConversionTable().toString(value
);
4200 TValues
getValue() const
4205 // return true if the actual value of the enum is valid, otherwise false
4208 if (_Value
== invalid_val
)
4211 // not invalid, check other enum value
4212 return getConversionTable().isValid(_Value
);
4218 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
4219 nlassert(it
!= getIndexTable().end());
4234 /// the highest valid value in the enum
4235 last_enum_item
= lang_other
,
4236 /// a value equal to the last enum item +1
4241 /// Number of enumerated values
4245 /// Index table to convert enum value to linear index table
4246 const std::map
<TValues
, uint32
> &getIndexTable() const
4248 static std::map
<TValues
, uint32
> indexTable
;
4249 static bool init
= false;
4252 // fill the index table
4253 indexTable
.insert(std::make_pair(lang_en
, 0));
4254 indexTable
.insert(std::make_pair(lang_fr
, 1));
4255 indexTable
.insert(std::make_pair(lang_de
, 2));
4256 indexTable
.insert(std::make_pair(lang_other
, 3));
4265 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
4267 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
4268 NL_STRING_CONVERSION_TABLE_ENTRY(lang_en
)
4269 NL_STRING_CONVERSION_TABLE_ENTRY(lang_fr
)
4270 NL_STRING_CONVERSION_TABLE_ENTRY(lang_de
)
4271 NL_STRING_CONVERSION_TABLE_ENTRY(lang_other
)
4272 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
4274 static NLMISC::CStringConversion
<TValues
>
4275 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
4276 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
4278 return conversionTable
;
4285 : _Value(invalid_val
)
4288 TLanguage(TValues value
)
4293 TLanguage(const std::string
&str
)
4295 _Value
= getConversionTable().fromString(str
);
4298 void serial(NLMISC::IStream
&s
)
4300 s
.serialEnum(_Value
);
4303 bool operator == (const TLanguage
&other
) const
4305 return _Value
== other
._Value
;
4307 bool operator != (const TLanguage
&other
) const
4309 return ! (_Value
== other
._Value
);
4311 bool operator < (const TLanguage
&other
) const
4313 return _Value
< other
._Value
;
4316 bool operator <= (const TLanguage
&other
) const
4318 return _Value
<= other
._Value
;
4321 bool operator > (const TLanguage
&other
) const
4323 return !(_Value
<= other
._Value
);
4325 bool operator >= (const TLanguage
&other
) const
4327 return !(_Value
< other
._Value
);
4330 const std::string
&toString() const
4332 return getConversionTable().toString(_Value
);
4334 static const std::string
&toString(TValues value
)
4336 return getConversionTable().toString(value
);
4339 TValues
getValue() const
4344 // return true if the actual value of the enum is valid, otherwise false
4347 if (_Value
== invalid_val
)
4350 // not invalid, check other enum value
4351 return getConversionTable().isValid(_Value
);
4357 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
4358 nlassert(it
!= getIndexTable().end());
4363 /////////////////////////////////////////////////////////////////
4364 // WARNING : this is a generated file, don't change it !
4365 /////////////////////////////////////////////////////////////////
4372 std::string _UserName
;
4374 uint32 _CurrentCharacter
;
4376 uint32 _CurrentSession
;
4378 TCurrentActivity _CurrentActivity
;
4380 TCurrentStatus _CurrentStatus
;
4382 TPublicLevel _PublicLevel
;
4384 TAccountType _AccountType
;
4386 std::string _ContentAccessLevel
;
4388 std::string _Description
;
4392 std::string _Cookie
;
4394 sint32 _CurrentDomainId
;
4396 std::string _AddedPrivileges
;
4398 friend class CKnownUser
;
4400 std::vector
< CKnownUserPtr
> *_KnownUsers
;
4402 friend class CCharacter
;
4404 std::map
< uint32
, CCharacterPtr
> *_Characters
;
4406 friend class CFolder
;
4408 std::vector
< CFolderPtr
> *_Folders
;
4410 friend class CFolderAccess
;
4412 std::vector
< CFolderAccessPtr
> *_FolderAccess
;
4413 friend class CGmStatus
;
4414 bool _GMStatusLoaded
;
4415 CGmStatusPtr _GMStatus
;
4418 const std::string
&getUserName() const
4425 void setUserName(const std::string
&value
)
4428 if (_UserName
!= value
)
4430 if (getPersistentState() != NOPE::os_transient
)
4431 setPersistentState(NOPE::os_dirty
);
4441 uint32
getCurrentCharacter() const
4443 return _CurrentCharacter
;
4446 void setCurrentCharacter(uint32 value
)
4449 if (_CurrentCharacter
!= value
)
4451 if (getPersistentState() != NOPE::os_transient
)
4452 setPersistentState(NOPE::os_dirty
);
4454 _CurrentCharacter
= value
;
4460 uint32
getCurrentSession() const
4462 return _CurrentSession
;
4465 void setCurrentSession(uint32 value
)
4468 if (_CurrentSession
!= value
)
4470 if (getPersistentState() != NOPE::os_transient
)
4471 setPersistentState(NOPE::os_dirty
);
4473 _CurrentSession
= value
;
4479 TCurrentActivity
getCurrentActivity() const
4481 return _CurrentActivity
;
4484 void setCurrentActivity(TCurrentActivity value
)
4487 if (_CurrentActivity
!= value
)
4489 if (getPersistentState() != NOPE::os_transient
)
4490 setPersistentState(NOPE::os_dirty
);
4492 _CurrentActivity
= value
;
4498 TCurrentStatus
getCurrentStatus() const
4500 return _CurrentStatus
;
4503 void setCurrentStatus(TCurrentStatus value
)
4506 if (_CurrentStatus
!= value
)
4508 if (getPersistentState() != NOPE::os_transient
)
4509 setPersistentState(NOPE::os_dirty
);
4511 _CurrentStatus
= value
;
4517 TPublicLevel
getPublicLevel() const
4519 return _PublicLevel
;
4522 void setPublicLevel(TPublicLevel value
)
4525 if (_PublicLevel
!= value
)
4527 if (getPersistentState() != NOPE::os_transient
)
4528 setPersistentState(NOPE::os_dirty
);
4530 _PublicLevel
= value
;
4536 TAccountType
getAccountType() const
4538 return _AccountType
;
4541 void setAccountType(TAccountType value
)
4544 if (_AccountType
!= value
)
4546 if (getPersistentState() != NOPE::os_transient
)
4547 setPersistentState(NOPE::os_dirty
);
4549 _AccountType
= value
;
4555 const std::string
&getContentAccessLevel() const
4557 return _ContentAccessLevel
;
4562 void setContentAccessLevel(const std::string
&value
)
4565 if (_ContentAccessLevel
!= value
)
4567 if (getPersistentState() != NOPE::os_transient
)
4568 setPersistentState(NOPE::os_dirty
);
4571 _ContentAccessLevel
= value
;
4578 const std::string
&getDescription() const
4580 return _Description
;
4585 void setDescription(const std::string
&value
)
4588 if (_Description
!= value
)
4590 if (getPersistentState() != NOPE::os_transient
)
4591 setPersistentState(NOPE::os_dirty
);
4594 _Description
= value
;
4601 TLanguage
getLang() const
4606 void setLang(TLanguage value
)
4611 if (getPersistentState() != NOPE::os_transient
)
4612 setPersistentState(NOPE::os_dirty
);
4620 const std::string
&getCookie() const
4627 void setCookie(const std::string
&value
)
4630 if (_Cookie
!= value
)
4632 if (getPersistentState() != NOPE::os_transient
)
4633 setPersistentState(NOPE::os_dirty
);
4643 sint32
getCurrentDomainId() const
4645 return _CurrentDomainId
;
4648 void setCurrentDomainId(sint32 value
)
4651 if (_CurrentDomainId
!= value
)
4653 if (getPersistentState() != NOPE::os_transient
)
4654 setPersistentState(NOPE::os_dirty
);
4656 _CurrentDomainId
= value
;
4662 const std::string
&getAddedPrivileges() const
4664 return _AddedPrivileges
;
4669 void setAddedPrivileges(const std::string
&value
)
4672 if (_AddedPrivileges
!= value
)
4674 if (getPersistentState() != NOPE::os_transient
)
4675 setPersistentState(NOPE::os_dirty
);
4678 _AddedPrivileges
= value
;
4685 /** Return a const reference to the vector of child.
4686 * If you want to modify the element inside, you need to
4687 * use on of the two following methods who return non const pointer
4688 * on contained elements.
4690 const std::vector
<CKnownUserPtr
> &getKnownUsers() const;
4691 /** Return the ith element of the child vector
4692 * index must be valid (ie less than size of the vector)
4694 CKnownUserPtr
&getKnownUsersByIndex(uint32 index
) const;
4695 /** Return the identified element by looking in the vector
4696 * If no element match the id, NULL pointer is returned
4698 CKnownUserPtr
&getKnownUsersById(uint32 id
) const;
4701 /** Return a const reference to the map of child.
4702 * If you want to modify the element inside, you need to
4703 * use on of the two following method who return non const pointer
4704 * on contained elements.
4706 const std::map
<uint32
, CCharacterPtr
> &getCharacters() const;
4707 /** Return the identified element by looking in the map
4708 * If no element match the id, NULL pointer is returned
4710 CCharacterPtr
&getCharactersById(uint32 id
) const;
4713 /** Return a const reference to the vector of child.
4714 * If you want to modify the element inside, you need to
4715 * use on of the two following methods who return non const pointer
4716 * on contained elements.
4718 const std::vector
<CFolderPtr
> &getFolders() const;
4719 /** Return the ith element of the child vector
4720 * index must be valid (ie less than size of the vector)
4722 CFolderPtr
&getFoldersByIndex(uint32 index
) const;
4723 /** Return the identified element by looking in the vector
4724 * If no element match the id, NULL pointer is returned
4726 CFolderPtr
&getFoldersById(uint32 id
) const;
4729 /** Return a const reference to the vector of child.
4730 * If you want to modify the element inside, you need to
4731 * use on of the two following methods who return non const pointer
4732 * on contained elements.
4734 const std::vector
<CFolderAccessPtr
> &getFolderAccess() const;
4735 /** Return the ith element of the child vector
4736 * index must be valid (ie less than size of the vector)
4738 CFolderAccessPtr
&getFolderAccessByIndex(uint32 index
) const;
4739 /** Return the identified element by looking in the vector
4740 * If no element match the id, NULL pointer is returned
4742 CFolderAccessPtr
&getFolderAccessById(uint32 id
) const;
4745 /** Return the one child object (or null if not) */
4746 CGmStatusPtr
getGMStatus();
4748 bool operator == (const CRingUser
&other
) const
4750 return _UserId
== other
._UserId
4751 && _UserName
== other
._UserName
4752 && _CurrentCharacter
== other
._CurrentCharacter
4753 && _CurrentSession
== other
._CurrentSession
4754 && _CurrentActivity
== other
._CurrentActivity
4755 && _CurrentStatus
== other
._CurrentStatus
4756 && _PublicLevel
== other
._PublicLevel
4757 && _AccountType
== other
._AccountType
4758 && _ContentAccessLevel
== other
._ContentAccessLevel
4759 && _Description
== other
._Description
4760 && _Lang
== other
._Lang
4761 && _Cookie
== other
._Cookie
4762 && _CurrentDomainId
== other
._CurrentDomainId
4763 && _AddedPrivileges
== other
._AddedPrivileges
;
4768 // private constructor, you must use 'createTransient' to get an instance
4771 _ObjectState(NOPE::os_transient
),
4772 _UserId(NOPE::INVALID_OBJECT_ID
)
4777 _FolderAccess
= NULL
;
4778 _GMStatusLoaded
= false;
4780 // register the cache for this class (if not already done)
4781 registerUpdatable();
4784 // Destructor, delete any children
4787 /// utility func to remove this object from the released object container
4788 void removeFromReleased();
4792 /// Create a new instance in the transient space
4793 static CRingUserPtr
createTransient(const char *filename
, uint32 lineNum
)
4795 return CRingUserPtr(new CRingUser(), filename
, lineNum
);
4798 /** Create a new object in the database from the current object data.
4799 * The object MUST be in transient state (i.e, it must be a new
4800 * object created by user and not comming from the databse).
4801 * If identifier is autogenerated, the generated id can be read after
4804 bool create(MSW::CConnection
&connection
);
4805 /** Update the database with the current object state.
4806 * The object MUST be either in clean or dirty state.
4807 * Return true if the object has been effectively stored
4809 * After this call, the object is in 'clean' state.
4811 bool update(MSW::CConnection
&connection
);
4812 /** Remove the current object from the persistent storage.
4813 * The object must be in clean or dirty state.
4814 * Return true if the object has been correctly
4815 * updated in the database.
4816 * After the call, the object is in 'clean' state.
4818 bool remove(MSW::CConnection
&connection
);
4819 /** Remove an object from the persistent storage by specifying
4821 * Return true if an entry as been effectively removed from
4823 * After the call, the object is in 'removed' state and should
4824 * no more be used. A good pratice should be to delete
4825 * the transient object just after the remove call.
4827 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
4829 /** Load an instance from the database.
4830 * This call allocate a new object and load the property value
4831 * from the database.
4832 * Return NULL if the object id is not found.
4834 static CRingUserPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
4837 /// Load KnownUsers child(ren) object(s).
4838 bool loadKnownUsers(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
4840 /// Load Characters child(ren) object(s).
4841 bool loadCharacters(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
4843 /// Load Folders child(ren) object(s).
4844 bool loadFolders(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
4846 /// Load FolderAccess child(ren) object(s).
4847 bool loadFolderAccess(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
4849 /// Load GMStatus child(ren) object(s).
4850 bool loadGMStatus(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
4856 friend class CPersistentCache
;
4857 friend class CRingUserPtr
;
4859 typedef std::map
<uint32
, CRingUser
*> TObjectCache
;
4860 typedef std::set
<CRingUser
*> TObjectSet
;
4861 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
4863 /// The complete set of object currently in memory (either active or released) excluding transient instance
4864 static TObjectCache _ObjectCache
;
4865 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
4866 static TReleasedObject _ReleasedObject
;
4868 /// The current object state
4869 NOPE::TObjectState _ObjectState
;
4871 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
4872 time_t _ReleaseDate
;
4874 /// The linked list of pointer on this object
4875 CRingUserPtr
*_PtrList
;
4877 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
4878 static CRingUser
*loadFromCache(uint32 objectId
, bool unrelease
);
4880 // Receive and execute command from the cache manager.
4881 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
4885 static void updateCache();
4888 static void clearCache();
4890 void registerUpdatable();
4892 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
4893 void setFirstPtr(CRingUserPtr
*ptr
);
4895 // return the first pointer of the pointer list (can be null)
4896 CRingUserPtr
*getFirstPtr()
4903 /** Return the object identifier (witch is unique)
4904 * You can only call this method on a persistent instance.
4905 * (because transient instance can have invalid id)
4907 uint32
getObjectId() const
4913 /** Set the object unique ID.
4914 * You can only set the object id on a transient object
4915 * having a non autogenerated unique id.
4916 * Furthermore, you MUST set the id before calling create()
4917 * if the id is not autogenerated.
4919 void setObjectId(uint32 objectId
)
4921 // can only be set when in transient state
4922 nlassert(getPersistentState() == NOPE::os_transient
);
4923 // can only be set once
4924 nlassert(_UserId
== NOPE::INVALID_OBJECT_ID
);
4928 /** Return the current persistent state of the object.*/
4929 NOPE::TObjectState
getPersistentState() const
4931 return _ObjectState
;
4935 // Set the persistent state of the object and do some house keeping
4936 void setPersistentState(NOPE::TObjectState state
);
4945 struct TRelationToParent
4952 /// the highest valid value in the enum
4953 last_enum_item
= rtp_different
,
4954 /// a value equal to the last enum item +1
4959 /// Number of enumerated values
4963 /// Index table to convert enum value to linear index table
4964 const std::map
<TValues
, uint32
> &getIndexTable() const
4966 static std::map
<TValues
, uint32
> indexTable
;
4967 static bool init
= false;
4970 // fill the index table
4971 indexTable
.insert(std::make_pair(rtp_same
, 0));
4972 indexTable
.insert(std::make_pair(rtp_variant
, 1));
4973 indexTable
.insert(std::make_pair(rtp_different
, 2));
4982 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
4984 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
4985 NL_STRING_CONVERSION_TABLE_ENTRY(rtp_same
)
4986 NL_STRING_CONVERSION_TABLE_ENTRY(rtp_variant
)
4987 NL_STRING_CONVERSION_TABLE_ENTRY(rtp_different
)
4988 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
4990 static NLMISC::CStringConversion
<TValues
>
4991 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
4992 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
4994 return conversionTable
;
5001 : _Value(invalid_val
)
5004 TRelationToParent(TValues value
)
5009 TRelationToParent(const std::string
&str
)
5011 _Value
= getConversionTable().fromString(str
);
5014 void serial(NLMISC::IStream
&s
)
5016 s
.serialEnum(_Value
);
5019 bool operator == (const TRelationToParent
&other
) const
5021 return _Value
== other
._Value
;
5023 bool operator != (const TRelationToParent
&other
) const
5025 return ! (_Value
== other
._Value
);
5027 bool operator < (const TRelationToParent
&other
) const
5029 return _Value
< other
._Value
;
5032 bool operator <= (const TRelationToParent
&other
) const
5034 return _Value
<= other
._Value
;
5037 bool operator > (const TRelationToParent
&other
) const
5039 return !(_Value
<= other
._Value
);
5041 bool operator >= (const TRelationToParent
&other
) const
5043 return !(_Value
< other
._Value
);
5046 const std::string
&toString() const
5048 return getConversionTable().toString(_Value
);
5050 static const std::string
&toString(TValues value
)
5052 return getConversionTable().toString(value
);
5055 TValues
getValue() const
5060 // return true if the actual value of the enum is valid, otherwise false
5063 if (_Value
== invalid_val
)
5066 // not invalid, check other enum value
5067 return getConversionTable().isValid(_Value
);
5073 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
5074 nlassert(it
!= getIndexTable().end());
5087 /// the highest valid value in the enum
5088 last_enum_item
= pt_pvp
,
5089 /// a value equal to the last enum item +1
5094 /// Number of enumerated values
5098 /// Index table to convert enum value to linear index table
5099 const std::map
<TValues
, uint32
> &getIndexTable() const
5101 static std::map
<TValues
, uint32
> indexTable
;
5102 static bool init
= false;
5105 // fill the index table
5106 indexTable
.insert(std::make_pair(pt_rp
, 0));
5107 indexTable
.insert(std::make_pair(pt_pvp
, 1));
5116 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
5118 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
5119 NL_STRING_CONVERSION_TABLE_ENTRY(pt_rp
)
5120 NL_STRING_CONVERSION_TABLE_ENTRY(pt_pvp
)
5121 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
5123 static NLMISC::CStringConversion
<TValues
>
5124 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
5125 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
5127 return conversionTable
;
5134 : _Value(invalid_val
)
5137 TPlayType(TValues value
)
5142 TPlayType(const std::string
&str
)
5144 _Value
= getConversionTable().fromString(str
);
5147 void serial(NLMISC::IStream
&s
)
5149 s
.serialEnum(_Value
);
5152 bool operator == (const TPlayType
&other
) const
5154 return _Value
== other
._Value
;
5156 bool operator != (const TPlayType
&other
) const
5158 return ! (_Value
== other
._Value
);
5160 bool operator < (const TPlayType
&other
) const
5162 return _Value
< other
._Value
;
5165 bool operator <= (const TPlayType
&other
) const
5167 return _Value
<= other
._Value
;
5170 bool operator > (const TPlayType
&other
) const
5172 return !(_Value
<= other
._Value
);
5174 bool operator >= (const TPlayType
&other
) const
5176 return !(_Value
< other
._Value
);
5179 const std::string
&toString() const
5181 return getConversionTable().toString(_Value
);
5183 static const std::string
&toString(TValues value
)
5185 return getConversionTable().toString(value
);
5188 TValues
getValue() const
5193 // return true if the actual value of the enum is valid, otherwise false
5196 if (_Value
== invalid_val
)
5199 // not invalid, check other enum value
5200 return getConversionTable().isValid(_Value
);
5206 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
5207 nlassert(it
!= getIndexTable().end());
5212 /////////////////////////////////////////////////////////////////
5213 // WARNING : this is a generated file, don't change it !
5214 /////////////////////////////////////////////////////////////////
5219 TSessionId _SessionId
;
5221 TSessionType _SessionType
;
5231 std::string _Description
;
5233 TSessionOrientation _Orientation
;
5235 R2::TSessionLevel _Level
;
5237 TRuleType _RuleType
;
5239 TAccessType _AccessType
;
5241 TSessionState _State
;
5243 uint32 _HostShardId
;
5245 uint32 _SubscriptionSlots
;
5247 uint32 _ReservedSlots
;
5249 TEstimatedDuration _EstimatedDuration
;
5251 uint32 _FinalDuration
;
5259 TAnimMode _AnimMode
;
5261 TRaceFilter _RaceFilter
;
5263 TReligionFilter _ReligionFilter
;
5265 TGuildFilter _GuildFilter
;
5267 TShardFilter _ShardFilter
;
5269 TLevelFilter _LevelFilter
;
5271 bool _SubscriptionClosed
;
5275 friend class CSessionParticipant
;
5277 std::vector
< CSessionParticipantPtr
> *_SessionParticipants
;
5279 friend class CGuildInvite
;
5281 std::vector
< CGuildInvitePtr
> *_GuildInvites
;
5283 friend class CJournalEntry
;
5285 std::vector
< CJournalEntryPtr
> *_JournalEntries
;
5288 TSessionType
getSessionType() const
5290 return _SessionType
;
5293 void setSessionType(TSessionType value
)
5296 if (_SessionType
!= value
)
5298 if (getPersistentState() != NOPE::os_transient
)
5299 setPersistentState(NOPE::os_dirty
);
5301 _SessionType
= value
;
5307 const std::string
&getTitle() const
5314 void setTitle(const std::string
&value
)
5317 if (_Title
!= value
)
5319 if (getPersistentState() != NOPE::os_transient
)
5320 setPersistentState(NOPE::os_dirty
);
5330 uint32
getOwnerId() const
5335 void setOwnerId(uint32 value
)
5338 if (_OwnerId
!= value
)
5340 if (getPersistentState() != NOPE::os_transient
)
5341 setPersistentState(NOPE::os_dirty
);
5349 uint32
getPlanDate() const
5354 void setPlanDate(uint32 value
)
5357 if (_PlanDate
!= value
)
5359 if (getPersistentState() != NOPE::os_transient
)
5360 setPersistentState(NOPE::os_dirty
);
5368 uint32
getStartDate() const
5373 void setStartDate(uint32 value
)
5376 if (_StartDate
!= value
)
5378 if (getPersistentState() != NOPE::os_transient
)
5379 setPersistentState(NOPE::os_dirty
);
5387 const std::string
&getDescription() const
5389 return _Description
;
5394 void setDescription(const std::string
&value
)
5397 if (_Description
!= value
)
5399 if (getPersistentState() != NOPE::os_transient
)
5400 setPersistentState(NOPE::os_dirty
);
5403 _Description
= value
;
5410 TSessionOrientation
getOrientation() const
5412 return _Orientation
;
5415 void setOrientation(TSessionOrientation value
)
5418 if (_Orientation
!= value
)
5420 if (getPersistentState() != NOPE::os_transient
)
5421 setPersistentState(NOPE::os_dirty
);
5423 _Orientation
= value
;
5429 R2::TSessionLevel
getLevel() const
5434 void setLevel(R2::TSessionLevel value
)
5437 if (_Level
!= value
)
5439 if (getPersistentState() != NOPE::os_transient
)
5440 setPersistentState(NOPE::os_dirty
);
5448 TRuleType
getRuleType() const
5453 void setRuleType(TRuleType value
)
5456 if (_RuleType
!= value
)
5458 if (getPersistentState() != NOPE::os_transient
)
5459 setPersistentState(NOPE::os_dirty
);
5467 TAccessType
getAccessType() const
5472 void setAccessType(TAccessType value
)
5475 if (_AccessType
!= value
)
5477 if (getPersistentState() != NOPE::os_transient
)
5478 setPersistentState(NOPE::os_dirty
);
5480 _AccessType
= value
;
5486 TSessionState
getState() const
5491 void setState(TSessionState value
)
5494 if (_State
!= value
)
5496 if (getPersistentState() != NOPE::os_transient
)
5497 setPersistentState(NOPE::os_dirty
);
5505 uint32
getHostShardId() const
5507 return _HostShardId
;
5510 void setHostShardId(uint32 value
)
5513 if (_HostShardId
!= value
)
5515 if (getPersistentState() != NOPE::os_transient
)
5516 setPersistentState(NOPE::os_dirty
);
5518 _HostShardId
= value
;
5524 uint32
getSubscriptionSlots() const
5526 return _SubscriptionSlots
;
5529 void setSubscriptionSlots(uint32 value
)
5532 if (_SubscriptionSlots
!= value
)
5534 if (getPersistentState() != NOPE::os_transient
)
5535 setPersistentState(NOPE::os_dirty
);
5537 _SubscriptionSlots
= value
;
5543 uint32
getReservedSlots() const
5545 return _ReservedSlots
;
5548 void setReservedSlots(uint32 value
)
5551 if (_ReservedSlots
!= value
)
5553 if (getPersistentState() != NOPE::os_transient
)
5554 setPersistentState(NOPE::os_dirty
);
5556 _ReservedSlots
= value
;
5562 TEstimatedDuration
getEstimatedDuration() const
5564 return _EstimatedDuration
;
5567 void setEstimatedDuration(TEstimatedDuration value
)
5570 if (_EstimatedDuration
!= value
)
5572 if (getPersistentState() != NOPE::os_transient
)
5573 setPersistentState(NOPE::os_dirty
);
5575 _EstimatedDuration
= value
;
5581 uint32
getFinalDuration() const
5583 return _FinalDuration
;
5586 void setFinalDuration(uint32 value
)
5589 if (_FinalDuration
!= value
)
5591 if (getPersistentState() != NOPE::os_transient
)
5592 setPersistentState(NOPE::os_dirty
);
5594 _FinalDuration
= value
;
5600 uint32
getFolderId() const
5605 void setFolderId(uint32 value
)
5608 if (_FolderId
!= value
)
5610 if (getPersistentState() != NOPE::os_transient
)
5611 setPersistentState(NOPE::os_dirty
);
5619 const std::string
&getLang() const
5626 void setLang(const std::string
&value
)
5631 if (getPersistentState() != NOPE::os_transient
)
5632 setPersistentState(NOPE::os_dirty
);
5642 const std::string
&getIcone() const
5649 void setIcone(const std::string
&value
)
5652 if (_Icone
!= value
)
5654 if (getPersistentState() != NOPE::os_transient
)
5655 setPersistentState(NOPE::os_dirty
);
5665 TAnimMode
getAnimMode() const
5670 void setAnimMode(TAnimMode value
)
5673 if (_AnimMode
!= value
)
5675 if (getPersistentState() != NOPE::os_transient
)
5676 setPersistentState(NOPE::os_dirty
);
5684 TRaceFilter
getRaceFilter() const
5689 void setRaceFilter(TRaceFilter value
)
5692 if (_RaceFilter
!= value
)
5694 if (getPersistentState() != NOPE::os_transient
)
5695 setPersistentState(NOPE::os_dirty
);
5697 _RaceFilter
= value
;
5703 TReligionFilter
getReligionFilter() const
5705 return _ReligionFilter
;
5708 void setReligionFilter(TReligionFilter value
)
5711 if (_ReligionFilter
!= value
)
5713 if (getPersistentState() != NOPE::os_transient
)
5714 setPersistentState(NOPE::os_dirty
);
5716 _ReligionFilter
= value
;
5722 TGuildFilter
getGuildFilter() const
5724 return _GuildFilter
;
5727 void setGuildFilter(TGuildFilter value
)
5730 if (_GuildFilter
!= value
)
5732 if (getPersistentState() != NOPE::os_transient
)
5733 setPersistentState(NOPE::os_dirty
);
5735 _GuildFilter
= value
;
5741 TShardFilter
getShardFilter() const
5743 return _ShardFilter
;
5746 void setShardFilter(TShardFilter value
)
5749 if (_ShardFilter
!= value
)
5751 if (getPersistentState() != NOPE::os_transient
)
5752 setPersistentState(NOPE::os_dirty
);
5754 _ShardFilter
= value
;
5760 TLevelFilter
getLevelFilter() const
5762 return _LevelFilter
;
5765 void setLevelFilter(TLevelFilter value
)
5768 if (_LevelFilter
!= value
)
5770 if (getPersistentState() != NOPE::os_transient
)
5771 setPersistentState(NOPE::os_dirty
);
5773 _LevelFilter
= value
;
5779 bool getSubscriptionClosed() const
5781 return _SubscriptionClosed
;
5784 void setSubscriptionClosed(bool value
)
5787 if (_SubscriptionClosed
!= value
)
5789 if (getPersistentState() != NOPE::os_transient
)
5790 setPersistentState(NOPE::os_dirty
);
5792 _SubscriptionClosed
= value
;
5798 bool getNewcomer() const
5803 void setNewcomer(bool value
)
5806 if (_Newcomer
!= value
)
5808 if (getPersistentState() != NOPE::os_transient
)
5809 setPersistentState(NOPE::os_dirty
);
5817 /** Return a const reference to the vector of child.
5818 * If you want to modify the element inside, you need to
5819 * use on of the two following methods who return non const pointer
5820 * on contained elements.
5822 const std::vector
<CSessionParticipantPtr
> &getSessionParticipants() const;
5823 /** Return the ith element of the child vector
5824 * index must be valid (ie less than size of the vector)
5826 CSessionParticipantPtr
&getSessionParticipantsByIndex(uint32 index
) const;
5827 /** Return the identified element by looking in the vector
5828 * If no element match the id, NULL pointer is returned
5830 CSessionParticipantPtr
&getSessionParticipantsById(uint32 id
) const;
5833 /** Return a const reference to the vector of child.
5834 * If you want to modify the element inside, you need to
5835 * use on of the two following methods who return non const pointer
5836 * on contained elements.
5838 const std::vector
<CGuildInvitePtr
> &getGuildInvites() const;
5839 /** Return the ith element of the child vector
5840 * index must be valid (ie less than size of the vector)
5842 CGuildInvitePtr
&getGuildInvitesByIndex(uint32 index
) const;
5843 /** Return the identified element by looking in the vector
5844 * If no element match the id, NULL pointer is returned
5846 CGuildInvitePtr
&getGuildInvitesById(uint32 id
) const;
5849 /** Return a const reference to the vector of child.
5850 * If you want to modify the element inside, you need to
5851 * use on of the two following methods who return non const pointer
5852 * on contained elements.
5854 const std::vector
<CJournalEntryPtr
> &getJournalEntries() const;
5855 /** Return the ith element of the child vector
5856 * index must be valid (ie less than size of the vector)
5858 CJournalEntryPtr
&getJournalEntriesByIndex(uint32 index
) const;
5859 /** Return the identified element by looking in the vector
5860 * If no element match the id, NULL pointer is returned
5862 CJournalEntryPtr
&getJournalEntriesById(uint32 id
) const;
5865 bool operator == (const CSession
&other
) const
5867 return _SessionId
== other
._SessionId
5868 && _SessionType
== other
._SessionType
5869 && _Title
== other
._Title
5870 && _OwnerId
== other
._OwnerId
5871 && _PlanDate
== other
._PlanDate
5872 && _StartDate
== other
._StartDate
5873 && _Description
== other
._Description
5874 && _Orientation
== other
._Orientation
5875 && _Level
== other
._Level
5876 && _RuleType
== other
._RuleType
5877 && _AccessType
== other
._AccessType
5878 && _State
== other
._State
5879 && _HostShardId
== other
._HostShardId
5880 && _SubscriptionSlots
== other
._SubscriptionSlots
5881 && _ReservedSlots
== other
._ReservedSlots
5882 && _EstimatedDuration
== other
._EstimatedDuration
5883 && _FinalDuration
== other
._FinalDuration
5884 && _FolderId
== other
._FolderId
5885 && _Lang
== other
._Lang
5886 && _Icone
== other
._Icone
5887 && _AnimMode
== other
._AnimMode
5888 && _RaceFilter
== other
._RaceFilter
5889 && _ReligionFilter
== other
._ReligionFilter
5890 && _GuildFilter
== other
._GuildFilter
5891 && _ShardFilter
== other
._ShardFilter
5892 && _LevelFilter
== other
._LevelFilter
5893 && _SubscriptionClosed
== other
._SubscriptionClosed
5894 && _Newcomer
== other
._Newcomer
;
5899 // private constructor, you must use 'createTransient' to get an instance
5902 _ObjectState(NOPE::os_transient
),
5903 _SessionId(NOPE::INVALID_OBJECT_ID
)
5905 // Default initialisation
5906 _AccessType
= TAccessType::at_private
;
5908 _SessionParticipants
= NULL
;
5909 _GuildInvites
= NULL
;
5910 _JournalEntries
= NULL
;
5912 // register the cache for this class (if not already done)
5913 registerUpdatable();
5916 // Destructor, delete any children
5919 /// utility func to remove this object from the released object container
5920 void removeFromReleased();
5924 /// Create a new instance in the transient space
5925 static CSessionPtr
createTransient(const char *filename
, uint32 lineNum
)
5927 return CSessionPtr(new CSession(), filename
, lineNum
);
5930 /** Create a new object in the database from the current object data.
5931 * The object MUST be in transient state (i.e, it must be a new
5932 * object created by user and not comming from the databse).
5933 * If identifier is autogenerated, the generated id can be read after
5936 bool create(MSW::CConnection
&connection
);
5937 /** Update the database with the current object state.
5938 * The object MUST be either in clean or dirty state.
5939 * Return true if the object has been effectively stored
5941 * After this call, the object is in 'clean' state.
5943 bool update(MSW::CConnection
&connection
);
5944 /** Remove the current object from the persistent storage.
5945 * The object must be in clean or dirty state.
5946 * Return true if the object has been correctly
5947 * updated in the database.
5948 * After the call, the object is in 'clean' state.
5950 bool remove(MSW::CConnection
&connection
);
5951 /** Remove an object from the persistent storage by specifying
5953 * Return true if an entry as been effectively removed from
5955 * After the call, the object is in 'removed' state and should
5956 * no more be used. A good pratice should be to delete
5957 * the transient object just after the remove call.
5959 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
5961 /** Load an instance from the database.
5962 * This call allocate a new object and load the property value
5963 * from the database.
5964 * Return NULL if the object id is not found.
5966 static CSessionPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
5969 /** Load all objects children of CCharacter and
5970 * return them by using the specified output iterator.
5973 static bool loadChildrenOfCCharacter(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CSessionPtr
> &children
, const char *filename
, uint32 lineNum
);
5975 /** Load all objects children of CFolder and
5976 * return them by using the specified output iterator.
5979 static bool loadChildrenOfCFolder(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CSessionPtr
> &children
, const char *filename
, uint32 lineNum
);
5981 /// Load SessionParticipants child(ren) object(s).
5982 bool loadSessionParticipants(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
5984 /// Load GuildInvites child(ren) object(s).
5985 bool loadGuildInvites(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
5987 /// Load JournalEntries child(ren) object(s).
5988 bool loadJournalEntries(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
5994 friend class CPersistentCache
;
5995 friend class CSessionPtr
;
5997 typedef std::map
<uint32
, CSession
*> TObjectCache
;
5998 typedef std::set
<CSession
*> TObjectSet
;
5999 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
6001 /// The complete set of object currently in memory (either active or released) excluding transient instance
6002 static TObjectCache _ObjectCache
;
6003 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
6004 static TReleasedObject _ReleasedObject
;
6006 /// The current object state
6007 NOPE::TObjectState _ObjectState
;
6009 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
6010 time_t _ReleaseDate
;
6012 /// The linked list of pointer on this object
6013 CSessionPtr
*_PtrList
;
6015 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
6016 static CSession
*loadFromCache(uint32 objectId
, bool unrelease
);
6018 // Receive and execute command from the cache manager.
6019 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
6023 static void updateCache();
6026 static void clearCache();
6028 void registerUpdatable();
6030 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
6031 void setFirstPtr(CSessionPtr
*ptr
);
6033 // return the first pointer of the pointer list (can be null)
6034 CSessionPtr
*getFirstPtr()
6041 /** Return the object identifier (witch is unique)
6042 * You can only call this method on a persistent instance.
6043 * (because transient instance can have invalid id)
6045 uint32
getObjectId() const
6048 nlassert(getPersistentState() != NOPE::os_transient
);
6052 /** Set the object unique ID.
6053 * You can only set the object id on a transient object
6054 * having a non autogenerated unique id.
6055 * Furthermore, you MUST set the id before calling create()
6056 * if the id is not autogenerated.
6058 void setObjectId(uint32 objectId
)
6060 // can only be set when in transient state
6061 nlassert(getPersistentState() == NOPE::os_transient
);
6062 // can only be set once
6063 nlassert(_SessionId
== NOPE::INVALID_OBJECT_ID
);
6064 _SessionId
= objectId
;
6067 /** Return the current persistent state of the object.*/
6068 NOPE::TObjectState
getPersistentState() const
6070 return _ObjectState
;
6074 // Set the persistent state of the object and do some house keeping
6075 void setPersistentState(NOPE::TObjectState state
);
6092 /// the highest valid value in the enum
6093 last_enum_item
= ds_open
,
6094 /// a value equal to the last enum item +1
6099 /// Number of enumerated values
6103 /// Index table to convert enum value to linear index table
6104 const std::map
<TValues
, uint32
> &getIndexTable() const
6106 static std::map
<TValues
, uint32
> indexTable
;
6107 static bool init
= false;
6110 // fill the index table
6111 indexTable
.insert(std::make_pair(ds_close
, 0));
6112 indexTable
.insert(std::make_pair(ds_dev
, 1));
6113 indexTable
.insert(std::make_pair(ds_restricted
, 2));
6114 indexTable
.insert(std::make_pair(ds_open
, 3));
6123 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
6125 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
6126 NL_STRING_CONVERSION_TABLE_ENTRY(ds_close
)
6127 NL_STRING_CONVERSION_TABLE_ENTRY(ds_dev
)
6128 NL_STRING_CONVERSION_TABLE_ENTRY(ds_restricted
)
6129 NL_STRING_CONVERSION_TABLE_ENTRY(ds_open
)
6130 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
6132 static NLMISC::CStringConversion
<TValues
>
6133 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
6134 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
6136 return conversionTable
;
6143 : _Value(invalid_val
)
6146 TAccessLevel(TValues value
)
6151 TAccessLevel(const std::string
&str
)
6153 _Value
= getConversionTable().fromString(str
);
6156 void serial(NLMISC::IStream
&s
)
6158 s
.serialEnum(_Value
);
6161 bool operator == (const TAccessLevel
&other
) const
6163 return _Value
== other
._Value
;
6165 bool operator != (const TAccessLevel
&other
) const
6167 return ! (_Value
== other
._Value
);
6169 bool operator < (const TAccessLevel
&other
) const
6171 return _Value
< other
._Value
;
6174 bool operator <= (const TAccessLevel
&other
) const
6176 return _Value
<= other
._Value
;
6179 bool operator > (const TAccessLevel
&other
) const
6181 return !(_Value
<= other
._Value
);
6183 bool operator >= (const TAccessLevel
&other
) const
6185 return !(_Value
< other
._Value
);
6188 const std::string
&toString() const
6190 return getConversionTable().toString(_Value
);
6192 static const std::string
&toString(TValues value
)
6194 return getConversionTable().toString(value
);
6197 TValues
getValue() const
6202 // return true if the actual value of the enum is valid, otherwise false
6205 if (_Value
== invalid_val
)
6208 // not invalid, check other enum value
6209 return getConversionTable().isValid(_Value
);
6215 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
6216 nlassert(it
!= getIndexTable().end());
6221 /////////////////////////////////////////////////////////////////
6222 // WARNING : this is a generated file, don't change it !
6223 /////////////////////////////////////////////////////////////////
6232 TAccessLevel _RequiredState
;
6236 friend class CGuild
;
6238 std::map
< uint32
, CGuildPtr
> *_Guilds
;
6241 bool getWSOnline() const
6246 void setWSOnline(bool value
)
6249 if (_WSOnline
!= value
)
6251 if (getPersistentState() != NOPE::os_transient
)
6252 setPersistentState(NOPE::os_dirty
);
6260 const TAccessLevel
&getRequiredState() const
6262 return _RequiredState
;
6267 void setRequiredState(const TAccessLevel
&value
)
6270 if (_RequiredState
!= value
)
6272 if (getPersistentState() != NOPE::os_transient
)
6273 setPersistentState(NOPE::os_dirty
);
6276 _RequiredState
= value
;
6283 const std::string
&getMOTD() const
6290 void setMOTD(const std::string
&value
)
6295 if (getPersistentState() != NOPE::os_transient
)
6296 setPersistentState(NOPE::os_dirty
);
6306 /** Return a const reference to the map of child.
6307 * If you want to modify the element inside, you need to
6308 * use on of the two following method who return non const pointer
6309 * on contained elements.
6311 const std::map
<uint32
, CGuildPtr
> &getGuilds() const;
6312 /** Return the identified element by looking in the map
6313 * If no element match the id, NULL pointer is returned
6315 CGuildPtr
&getGuildsById(uint32 id
) const;
6318 bool operator == (const CShard
&other
) const
6320 return _ShardId
== other
._ShardId
6321 && _WSOnline
== other
._WSOnline
6322 && _RequiredState
== other
._RequiredState
6323 && _MOTD
== other
._MOTD
;
6328 // private constructor, you must use 'createTransient' to get an instance
6331 _ObjectState(NOPE::os_transient
),
6332 _ShardId(NOPE::INVALID_OBJECT_ID
)
6334 // Default initialisation
6338 // register the cache for this class (if not already done)
6339 registerUpdatable();
6342 // Destructor, delete any children
6345 /// utility func to remove this object from the released object container
6346 void removeFromReleased();
6350 /// Create a new instance in the transient space
6351 static CShardPtr
createTransient(const char *filename
, uint32 lineNum
)
6353 return CShardPtr(new CShard(), filename
, lineNum
);
6356 /** Create a new object in the database from the current object data.
6357 * The object MUST be in transient state (i.e, it must be a new
6358 * object created by user and not comming from the databse).
6359 * If identifier is autogenerated, the generated id can be read after
6362 bool create(MSW::CConnection
&connection
);
6363 /** Update the database with the current object state.
6364 * The object MUST be either in clean or dirty state.
6365 * Return true if the object has been effectively stored
6367 * After this call, the object is in 'clean' state.
6369 bool update(MSW::CConnection
&connection
);
6370 /** Remove the current object from the persistent storage.
6371 * The object must be in clean or dirty state.
6372 * Return true if the object has been correctly
6373 * updated in the database.
6374 * After the call, the object is in 'clean' state.
6376 bool remove(MSW::CConnection
&connection
);
6377 /** Remove an object from the persistent storage by specifying
6379 * Return true if an entry as been effectively removed from
6381 * After the call, the object is in 'removed' state and should
6382 * no more be used. A good pratice should be to delete
6383 * the transient object just after the remove call.
6385 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
6387 /** Load an instance from the database.
6388 * This call allocate a new object and load the property value
6389 * from the database.
6390 * Return NULL if the object id is not found.
6392 static CShardPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
6395 /// Load Guilds child(ren) object(s).
6396 bool loadGuilds(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
6402 friend class CPersistentCache
;
6403 friend class CShardPtr
;
6405 typedef std::map
<uint32
, CShard
*> TObjectCache
;
6406 typedef std::set
<CShard
*> TObjectSet
;
6407 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
6409 /// The complete set of object currently in memory (either active or released) excluding transient instance
6410 static TObjectCache _ObjectCache
;
6411 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
6412 static TReleasedObject _ReleasedObject
;
6414 /// The current object state
6415 NOPE::TObjectState _ObjectState
;
6417 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
6418 time_t _ReleaseDate
;
6420 /// The linked list of pointer on this object
6421 CShardPtr
*_PtrList
;
6423 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
6424 static CShard
*loadFromCache(uint32 objectId
, bool unrelease
);
6426 // Receive and execute command from the cache manager.
6427 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
6431 static void updateCache();
6434 static void clearCache();
6436 void registerUpdatable();
6438 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
6439 void setFirstPtr(CShardPtr
*ptr
);
6441 // return the first pointer of the pointer list (can be null)
6442 CShardPtr
*getFirstPtr()
6449 /** Return the object identifier (witch is unique)
6450 * You can only call this method on a persistent instance.
6451 * (because transient instance can have invalid id)
6453 uint32
getObjectId() const
6459 /** Set the object unique ID.
6460 * You can only set the object id on a transient object
6461 * having a non autogenerated unique id.
6462 * Furthermore, you MUST set the id before calling create()
6463 * if the id is not autogenerated.
6465 void setObjectId(uint32 objectId
)
6467 // can only be set when in transient state
6468 nlassert(getPersistentState() == NOPE::os_transient
);
6469 // can only be set once
6470 nlassert(_ShardId
== NOPE::INVALID_OBJECT_ID
);
6471 _ShardId
= objectId
;
6474 /** Return the current persistent state of the object.*/
6475 NOPE::TObjectState
getPersistentState() const
6477 return _ObjectState
;
6481 // Set the persistent state of the object and do some house keeping
6482 void setPersistentState(NOPE::TObjectState state
);
6489 /////////////////////////////////////////////////////////////////
6490 // WARNING : this is a generated file, don't change it !
6491 /////////////////////////////////////////////////////////////////
6498 std::string _GuildName
;
6502 friend class CCharacter
;
6504 std::vector
< CCharacterPtr
> *_Characters
;
6506 friend class CGuildInvite
;
6508 std::vector
< CGuildInvitePtr
> *_Invites
;
6511 const std::string
&getGuildName() const
6518 void setGuildName(const std::string
&value
)
6521 if (_GuildName
!= value
)
6523 if (getPersistentState() != NOPE::os_transient
)
6524 setPersistentState(NOPE::os_dirty
);
6534 uint32
getShardId() const
6539 void setShardId(uint32 value
)
6542 if (_ShardId
!= value
)
6544 if (getPersistentState() != NOPE::os_transient
)
6545 setPersistentState(NOPE::os_dirty
);
6553 /** Return a const reference to the vector of child.
6554 * If you want to modify the element inside, you need to
6555 * use on of the two following methods who return non const pointer
6556 * on contained elements.
6558 const std::vector
<CCharacterPtr
> &getCharacters() const;
6559 /** Return the ith element of the child vector
6560 * index must be valid (ie less than size of the vector)
6562 CCharacterPtr
&getCharactersByIndex(uint32 index
) const;
6563 /** Return the identified element by looking in the vector
6564 * If no element match the id, NULL pointer is returned
6566 CCharacterPtr
&getCharactersById(uint32 id
) const;
6569 /** Return a const reference to the vector of child.
6570 * If you want to modify the element inside, you need to
6571 * use on of the two following methods who return non const pointer
6572 * on contained elements.
6574 const std::vector
<CGuildInvitePtr
> &getInvites() const;
6575 /** Return the ith element of the child vector
6576 * index must be valid (ie less than size of the vector)
6578 CGuildInvitePtr
&getInvitesByIndex(uint32 index
) const;
6579 /** Return the identified element by looking in the vector
6580 * If no element match the id, NULL pointer is returned
6582 CGuildInvitePtr
&getInvitesById(uint32 id
) const;
6585 bool operator == (const CGuild
&other
) const
6587 return _GuildId
== other
._GuildId
6588 && _GuildName
== other
._GuildName
6589 && _ShardId
== other
._ShardId
;
6594 // private constructor, you must use 'createTransient' to get an instance
6597 _ObjectState(NOPE::os_transient
),
6598 _GuildId(NOPE::INVALID_OBJECT_ID
)
6603 // register the cache for this class (if not already done)
6604 registerUpdatable();
6607 // Destructor, delete any children
6610 /// utility func to remove this object from the released object container
6611 void removeFromReleased();
6615 /// Create a new instance in the transient space
6616 static CGuildPtr
createTransient(const char *filename
, uint32 lineNum
)
6618 return CGuildPtr(new CGuild(), filename
, lineNum
);
6621 /** Create a new object in the database from the current object data.
6622 * The object MUST be in transient state (i.e, it must be a new
6623 * object created by user and not comming from the databse).
6624 * If identifier is autogenerated, the generated id can be read after
6627 bool create(MSW::CConnection
&connection
);
6628 /** Update the database with the current object state.
6629 * The object MUST be either in clean or dirty state.
6630 * Return true if the object has been effectively stored
6632 * After this call, the object is in 'clean' state.
6634 bool update(MSW::CConnection
&connection
);
6635 /** Remove the current object from the persistent storage.
6636 * The object must be in clean or dirty state.
6637 * Return true if the object has been correctly
6638 * updated in the database.
6639 * After the call, the object is in 'clean' state.
6641 bool remove(MSW::CConnection
&connection
);
6642 /** Remove an object from the persistent storage by specifying
6644 * Return true if an entry as been effectively removed from
6646 * After the call, the object is in 'removed' state and should
6647 * no more be used. A good pratice should be to delete
6648 * the transient object just after the remove call.
6650 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
6652 /** Load an instance from the database.
6653 * This call allocate a new object and load the property value
6654 * from the database.
6655 * Return NULL if the object id is not found.
6657 static CGuildPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
6660 /** Load all objects children of CShard and
6661 * return them by using the specified output iterator.
6664 static bool loadChildrenOfCShard(MSW::CConnection
&connection
, uint32 parentId
, std::map
< uint32
, CGuildPtr
> &children
, const char *filename
, uint32 lineNum
);
6666 /// Load Characters child(ren) object(s).
6667 bool loadCharacters(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
6669 /// Load Invites child(ren) object(s).
6670 bool loadInvites(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
6676 friend class CPersistentCache
;
6677 friend class CGuildPtr
;
6679 typedef std::map
<uint32
, CGuild
*> TObjectCache
;
6680 typedef std::set
<CGuild
*> TObjectSet
;
6681 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
6683 /// The complete set of object currently in memory (either active or released) excluding transient instance
6684 static TObjectCache _ObjectCache
;
6685 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
6686 static TReleasedObject _ReleasedObject
;
6688 /// The current object state
6689 NOPE::TObjectState _ObjectState
;
6691 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
6692 time_t _ReleaseDate
;
6694 /// The linked list of pointer on this object
6695 CGuildPtr
*_PtrList
;
6697 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
6698 static CGuild
*loadFromCache(uint32 objectId
, bool unrelease
);
6700 // Receive and execute command from the cache manager.
6701 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
6705 static void updateCache();
6708 static void clearCache();
6710 void registerUpdatable();
6712 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
6713 void setFirstPtr(CGuildPtr
*ptr
);
6715 // return the first pointer of the pointer list (can be null)
6716 CGuildPtr
*getFirstPtr()
6723 /** Return the object identifier (witch is unique)
6724 * You can only call this method on a persistent instance.
6725 * (because transient instance can have invalid id)
6727 uint32
getObjectId() const
6733 /** Set the object unique ID.
6734 * You can only set the object id on a transient object
6735 * having a non autogenerated unique id.
6736 * Furthermore, you MUST set the id before calling create()
6737 * if the id is not autogenerated.
6739 void setObjectId(uint32 objectId
)
6741 // can only be set when in transient state
6742 nlassert(getPersistentState() == NOPE::os_transient
);
6743 // can only be set once
6744 nlassert(_GuildId
== NOPE::INVALID_OBJECT_ID
);
6745 _GuildId
= objectId
;
6748 /** Return the current persistent state of the object.*/
6749 NOPE::TObjectState
getPersistentState() const
6751 return _ObjectState
;
6755 // Set the persistent state of the object and do some house keeping
6756 void setPersistentState(NOPE::TObjectState state
);
6763 /////////////////////////////////////////////////////////////////
6764 // WARNING : this is a generated file, don't change it !
6765 /////////////////////////////////////////////////////////////////
6774 TSessionId _SessionId
;
6777 uint32
getGuildId() const
6782 void setGuildId(uint32 value
)
6785 if (_GuildId
!= value
)
6787 if (getPersistentState() != NOPE::os_transient
)
6788 setPersistentState(NOPE::os_dirty
);
6796 TSessionId
getSessionId() const
6801 void setSessionId(TSessionId value
)
6804 if (_SessionId
!= value
)
6806 if (getPersistentState() != NOPE::os_transient
)
6807 setPersistentState(NOPE::os_dirty
);
6815 bool operator == (const CGuildInvite
&other
) const
6817 return _Id
== other
._Id
6818 && _GuildId
== other
._GuildId
6819 && _SessionId
== other
._SessionId
;
6824 // private constructor, you must use 'createTransient' to get an instance
6827 _ObjectState(NOPE::os_transient
),
6828 _Id(NOPE::INVALID_OBJECT_ID
)
6831 // register the cache for this class (if not already done)
6832 registerUpdatable();
6835 // Destructor, delete any children
6838 /// utility func to remove this object from the released object container
6839 void removeFromReleased();
6843 /// Create a new instance in the transient space
6844 static CGuildInvitePtr
createTransient(const char *filename
, uint32 lineNum
)
6846 return CGuildInvitePtr(new CGuildInvite(), filename
, lineNum
);
6849 /** Create a new object in the database from the current object data.
6850 * The object MUST be in transient state (i.e, it must be a new
6851 * object created by user and not comming from the databse).
6852 * If identifier is autogenerated, the generated id can be read after
6855 bool create(MSW::CConnection
&connection
);
6856 /** Update the database with the current object state.
6857 * The object MUST be either in clean or dirty state.
6858 * Return true if the object has been effectively stored
6860 * After this call, the object is in 'clean' state.
6862 bool update(MSW::CConnection
&connection
);
6863 /** Remove the current object from the persistent storage.
6864 * The object must be in clean or dirty state.
6865 * Return true if the object has been correctly
6866 * updated in the database.
6867 * After the call, the object is in 'clean' state.
6869 bool remove(MSW::CConnection
&connection
);
6870 /** Remove an object from the persistent storage by specifying
6872 * Return true if an entry as been effectively removed from
6874 * After the call, the object is in 'removed' state and should
6875 * no more be used. A good pratice should be to delete
6876 * the transient object just after the remove call.
6878 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
6880 /** Load an instance from the database.
6881 * This call allocate a new object and load the property value
6882 * from the database.
6883 * Return NULL if the object id is not found.
6885 static CGuildInvitePtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
6888 /** Load all objects children of CGuild and
6889 * return them by using the specified output iterator.
6892 static bool loadChildrenOfCGuild(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CGuildInvitePtr
> &children
, const char *filename
, uint32 lineNum
);
6894 /** Load all objects children of CSession and
6895 * return them by using the specified output iterator.
6898 static bool loadChildrenOfCSession(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CGuildInvitePtr
> &children
, const char *filename
, uint32 lineNum
);
6904 friend class CPersistentCache
;
6905 friend class CGuildInvitePtr
;
6907 typedef std::map
<uint32
, CGuildInvite
*> TObjectCache
;
6908 typedef std::set
<CGuildInvite
*> TObjectSet
;
6909 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
6911 /// The complete set of object currently in memory (either active or released) excluding transient instance
6912 static TObjectCache _ObjectCache
;
6913 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
6914 static TReleasedObject _ReleasedObject
;
6916 /// The current object state
6917 NOPE::TObjectState _ObjectState
;
6919 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
6920 time_t _ReleaseDate
;
6922 /// The linked list of pointer on this object
6923 CGuildInvitePtr
*_PtrList
;
6925 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
6926 static CGuildInvite
*loadFromCache(uint32 objectId
, bool unrelease
);
6928 // Receive and execute command from the cache manager.
6929 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
6933 static void updateCache();
6936 static void clearCache();
6938 void registerUpdatable();
6940 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
6941 void setFirstPtr(CGuildInvitePtr
*ptr
);
6943 // return the first pointer of the pointer list (can be null)
6944 CGuildInvitePtr
*getFirstPtr()
6951 /** Return the object identifier (witch is unique)
6952 * You can only call this method on a persistent instance.
6953 * (because transient instance can have invalid id)
6955 uint32
getObjectId() const
6958 nlassert(getPersistentState() != NOPE::os_transient
);
6962 /** Set the object unique ID.
6963 * You can only set the object id on a transient object
6964 * having a non autogenerated unique id.
6965 * Furthermore, you MUST set the id before calling create()
6966 * if the id is not autogenerated.
6968 void setObjectId(uint32 objectId
)
6970 // can only be set when in transient state
6971 nlassert(getPersistentState() == NOPE::os_transient
);
6972 // can only be set once
6973 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
6977 /** Return the current persistent state of the object.*/
6978 NOPE::TObjectState
getPersistentState() const
6980 return _ObjectState
;
6984 // Set the persistent state of the object and do some house keeping
6985 void setPersistentState(NOPE::TObjectState state
);
6992 /////////////////////////////////////////////////////////////////
6993 // WARNING : this is a generated file, don't change it !
6994 /////////////////////////////////////////////////////////////////
7007 uint32 _RateDifficulty
;
7009 uint32 _RateAccessibility
;
7011 uint32 _RateOriginality
;
7013 uint32 _RateDirection
;
7016 uint32
getScenarioId() const
7021 void setScenarioId(uint32 value
)
7024 if (_ScenarioId
!= value
)
7026 if (getPersistentState() != NOPE::os_transient
)
7027 setPersistentState(NOPE::os_dirty
);
7029 _ScenarioId
= value
;
7035 uint32
getAuthor() const
7040 void setAuthor(uint32 value
)
7043 if (_Author
!= value
)
7045 if (getPersistentState() != NOPE::os_transient
)
7046 setPersistentState(NOPE::os_dirty
);
7054 uint32
getRateFun() const
7059 void setRateFun(uint32 value
)
7062 if (_RateFun
!= value
)
7064 if (getPersistentState() != NOPE::os_transient
)
7065 setPersistentState(NOPE::os_dirty
);
7073 uint32
getRateDifficulty() const
7075 return _RateDifficulty
;
7078 void setRateDifficulty(uint32 value
)
7081 if (_RateDifficulty
!= value
)
7083 if (getPersistentState() != NOPE::os_transient
)
7084 setPersistentState(NOPE::os_dirty
);
7086 _RateDifficulty
= value
;
7092 uint32
getRateAccessibility() const
7094 return _RateAccessibility
;
7097 void setRateAccessibility(uint32 value
)
7100 if (_RateAccessibility
!= value
)
7102 if (getPersistentState() != NOPE::os_transient
)
7103 setPersistentState(NOPE::os_dirty
);
7105 _RateAccessibility
= value
;
7111 uint32
getRateOriginality() const
7113 return _RateOriginality
;
7116 void setRateOriginality(uint32 value
)
7119 if (_RateOriginality
!= value
)
7121 if (getPersistentState() != NOPE::os_transient
)
7122 setPersistentState(NOPE::os_dirty
);
7124 _RateOriginality
= value
;
7130 uint32
getRateDirection() const
7132 return _RateDirection
;
7135 void setRateDirection(uint32 value
)
7138 if (_RateDirection
!= value
)
7140 if (getPersistentState() != NOPE::os_transient
)
7141 setPersistentState(NOPE::os_dirty
);
7143 _RateDirection
= value
;
7149 bool operator == (const CPlayerRating
&other
) const
7151 return _Id
== other
._Id
7152 && _ScenarioId
== other
._ScenarioId
7153 && _Author
== other
._Author
7154 && _RateFun
== other
._RateFun
7155 && _RateDifficulty
== other
._RateDifficulty
7156 && _RateAccessibility
== other
._RateAccessibility
7157 && _RateOriginality
== other
._RateOriginality
7158 && _RateDirection
== other
._RateDirection
;
7163 // private constructor, you must use 'createTransient' to get an instance
7166 _ObjectState(NOPE::os_transient
),
7167 _Id(NOPE::INVALID_OBJECT_ID
)
7170 // register the cache for this class (if not already done)
7171 registerUpdatable();
7174 // Destructor, delete any children
7177 /// utility func to remove this object from the released object container
7178 void removeFromReleased();
7182 /// Create a new instance in the transient space
7183 static CPlayerRatingPtr
createTransient(const char *filename
, uint32 lineNum
)
7185 return CPlayerRatingPtr(new CPlayerRating(), filename
, lineNum
);
7188 /** Create a new object in the database from the current object data.
7189 * The object MUST be in transient state (i.e, it must be a new
7190 * object created by user and not comming from the databse).
7191 * If identifier is autogenerated, the generated id can be read after
7194 bool create(MSW::CConnection
&connection
);
7195 /** Update the database with the current object state.
7196 * The object MUST be either in clean or dirty state.
7197 * Return true if the object has been effectively stored
7199 * After this call, the object is in 'clean' state.
7201 bool update(MSW::CConnection
&connection
);
7202 /** Remove the current object from the persistent storage.
7203 * The object must be in clean or dirty state.
7204 * Return true if the object has been correctly
7205 * updated in the database.
7206 * After the call, the object is in 'clean' state.
7208 bool remove(MSW::CConnection
&connection
);
7209 /** Remove an object from the persistent storage by specifying
7211 * Return true if an entry as been effectively removed from
7213 * After the call, the object is in 'removed' state and should
7214 * no more be used. A good pratice should be to delete
7215 * the transient object just after the remove call.
7217 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
7219 /** Load an instance from the database.
7220 * This call allocate a new object and load the property value
7221 * from the database.
7222 * Return NULL if the object id is not found.
7224 static CPlayerRatingPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
7227 /** Load all objects children of CScenario and
7228 * return them by using the specified output iterator.
7231 static bool loadChildrenOfCScenario(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CPlayerRatingPtr
> &children
, const char *filename
, uint32 lineNum
);
7233 /** Load all objects children of CCharacter and
7234 * return them by using the specified output iterator.
7237 static bool loadChildrenOfCCharacter(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CPlayerRatingPtr
> &children
, const char *filename
, uint32 lineNum
);
7243 friend class CPersistentCache
;
7244 friend class CPlayerRatingPtr
;
7246 typedef std::map
<uint32
, CPlayerRating
*> TObjectCache
;
7247 typedef std::set
<CPlayerRating
*> TObjectSet
;
7248 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
7250 /// The complete set of object currently in memory (either active or released) excluding transient instance
7251 static TObjectCache _ObjectCache
;
7252 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
7253 static TReleasedObject _ReleasedObject
;
7255 /// The current object state
7256 NOPE::TObjectState _ObjectState
;
7258 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
7259 time_t _ReleaseDate
;
7261 /// The linked list of pointer on this object
7262 CPlayerRatingPtr
*_PtrList
;
7264 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
7265 static CPlayerRating
*loadFromCache(uint32 objectId
, bool unrelease
);
7267 // Receive and execute command from the cache manager.
7268 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
7272 static void updateCache();
7275 static void clearCache();
7277 void registerUpdatable();
7279 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
7280 void setFirstPtr(CPlayerRatingPtr
*ptr
);
7282 // return the first pointer of the pointer list (can be null)
7283 CPlayerRatingPtr
*getFirstPtr()
7290 /** Return the object identifier (witch is unique)
7291 * You can only call this method on a persistent instance.
7292 * (because transient instance can have invalid id)
7294 uint32
getObjectId() const
7297 nlassert(getPersistentState() != NOPE::os_transient
);
7301 /** Set the object unique ID.
7302 * You can only set the object id on a transient object
7303 * having a non autogenerated unique id.
7304 * Furthermore, you MUST set the id before calling create()
7305 * if the id is not autogenerated.
7307 void setObjectId(uint32 objectId
)
7309 // can only be set when in transient state
7310 nlassert(getPersistentState() == NOPE::os_transient
);
7311 // can only be set once
7312 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
7316 /** Return the current persistent state of the object.*/
7317 NOPE::TObjectState
getPersistentState() const
7319 return _ObjectState
;
7323 // Set the persistent state of the object and do some house keeping
7324 void setPersistentState(NOPE::TObjectState state
);
7333 struct TJournalEntryType
7339 /// the highest valid value in the enum
7340 last_enum_item
= jet_notes
,
7341 /// a value equal to the last enum item +1
7346 /// Number of enumerated values
7350 /// Index table to convert enum value to linear index table
7351 const std::map
<TValues
, uint32
> &getIndexTable() const
7353 static std::map
<TValues
, uint32
> indexTable
;
7354 static bool init
= false;
7357 // fill the index table
7358 indexTable
.insert(std::make_pair(jet_credits
, 0));
7359 indexTable
.insert(std::make_pair(jet_notes
, 1));
7368 static const NLMISC::CStringConversion
<TValues
> &getConversionTable()
7370 NL_BEGIN_STRING_CONVERSION_TABLE(TValues
)
7371 NL_STRING_CONVERSION_TABLE_ENTRY(jet_credits
)
7372 NL_STRING_CONVERSION_TABLE_ENTRY(jet_notes
)
7373 NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val
)
7375 static NLMISC::CStringConversion
<TValues
>
7376 conversionTable(TValues_nl_string_conversion_table
, sizeof(TValues_nl_string_conversion_table
)
7377 / sizeof(TValues_nl_string_conversion_table
[0]), invalid_val
);
7379 return conversionTable
;
7386 : _Value(invalid_val
)
7389 TJournalEntryType(TValues value
)
7394 TJournalEntryType(const std::string
&str
)
7396 _Value
= getConversionTable().fromString(str
);
7399 void serial(NLMISC::IStream
&s
)
7401 s
.serialEnum(_Value
);
7404 bool operator == (const TJournalEntryType
&other
) const
7406 return _Value
== other
._Value
;
7408 bool operator != (const TJournalEntryType
&other
) const
7410 return ! (_Value
== other
._Value
);
7412 bool operator < (const TJournalEntryType
&other
) const
7414 return _Value
< other
._Value
;
7417 bool operator <= (const TJournalEntryType
&other
) const
7419 return _Value
<= other
._Value
;
7422 bool operator > (const TJournalEntryType
&other
) const
7424 return !(_Value
<= other
._Value
);
7426 bool operator >= (const TJournalEntryType
&other
) const
7428 return !(_Value
< other
._Value
);
7431 const std::string
&toString() const
7433 return getConversionTable().toString(_Value
);
7435 static const std::string
&toString(TValues value
)
7437 return getConversionTable().toString(value
);
7440 TValues
getValue() const
7445 // return true if the actual value of the enum is valid, otherwise false
7448 if (_Value
== invalid_val
)
7451 // not invalid, check other enum value
7452 return getConversionTable().isValid(_Value
);
7458 std::map
<TValues
, uint32
>::const_iterator
it(getIndexTable().find(_Value
));
7459 nlassert(it
!= getIndexTable().end());
7464 /////////////////////////////////////////////////////////////////
7465 // WARNING : this is a generated file, don't change it !
7466 /////////////////////////////////////////////////////////////////
7473 TSessionId _SessionId
;
7477 TJournalEntryType _Type
;
7484 TSessionId
getSessionId() const
7489 void setSessionId(TSessionId value
)
7492 if (_SessionId
!= value
)
7494 if (getPersistentState() != NOPE::os_transient
)
7495 setPersistentState(NOPE::os_dirty
);
7503 uint32
getAuthor() const
7508 void setAuthor(uint32 value
)
7511 if (_Author
!= value
)
7513 if (getPersistentState() != NOPE::os_transient
)
7514 setPersistentState(NOPE::os_dirty
);
7522 TJournalEntryType
getType() const
7527 void setType(TJournalEntryType value
)
7532 if (getPersistentState() != NOPE::os_transient
)
7533 setPersistentState(NOPE::os_dirty
);
7541 const std::string
&getText() const
7548 void setText(const std::string
&value
)
7553 if (getPersistentState() != NOPE::os_transient
)
7554 setPersistentState(NOPE::os_dirty
);
7564 uint32
getTimeStamp() const
7569 void setTimeStamp(uint32 value
)
7572 if (_TimeStamp
!= value
)
7574 if (getPersistentState() != NOPE::os_transient
)
7575 setPersistentState(NOPE::os_dirty
);
7583 bool operator == (const CJournalEntry
&other
) const
7585 return _Id
== other
._Id
7586 && _SessionId
== other
._SessionId
7587 && _Author
== other
._Author
7588 && _Type
== other
._Type
7589 && _Text
== other
._Text
7590 && _TimeStamp
== other
._TimeStamp
;
7595 // private constructor, you must use 'createTransient' to get an instance
7598 _ObjectState(NOPE::os_transient
),
7599 _Id(NOPE::INVALID_OBJECT_ID
)
7602 // register the cache for this class (if not already done)
7603 registerUpdatable();
7606 // Destructor, delete any children
7609 /// utility func to remove this object from the released object container
7610 void removeFromReleased();
7614 /// Create a new instance in the transient space
7615 static CJournalEntryPtr
createTransient(const char *filename
, uint32 lineNum
)
7617 return CJournalEntryPtr(new CJournalEntry(), filename
, lineNum
);
7620 /** Create a new object in the database from the current object data.
7621 * The object MUST be in transient state (i.e, it must be a new
7622 * object created by user and not comming from the databse).
7623 * If identifier is autogenerated, the generated id can be read after
7626 bool create(MSW::CConnection
&connection
);
7627 /** Update the database with the current object state.
7628 * The object MUST be either in clean or dirty state.
7629 * Return true if the object has been effectively stored
7631 * After this call, the object is in 'clean' state.
7633 bool update(MSW::CConnection
&connection
);
7634 /** Remove the current object from the persistent storage.
7635 * The object must be in clean or dirty state.
7636 * Return true if the object has been correctly
7637 * updated in the database.
7638 * After the call, the object is in 'clean' state.
7640 bool remove(MSW::CConnection
&connection
);
7641 /** Remove an object from the persistent storage by specifying
7643 * Return true if an entry as been effectively removed from
7645 * After the call, the object is in 'removed' state and should
7646 * no more be used. A good pratice should be to delete
7647 * the transient object just after the remove call.
7649 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
7651 /** Load an instance from the database.
7652 * This call allocate a new object and load the property value
7653 * from the database.
7654 * Return NULL if the object id is not found.
7656 static CJournalEntryPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
7659 /** Load all objects children of CSession and
7660 * return them by using the specified output iterator.
7663 static bool loadChildrenOfCSession(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CJournalEntryPtr
> &children
, const char *filename
, uint32 lineNum
);
7669 friend class CPersistentCache
;
7670 friend class CJournalEntryPtr
;
7672 typedef std::map
<uint32
, CJournalEntry
*> TObjectCache
;
7673 typedef std::set
<CJournalEntry
*> TObjectSet
;
7674 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
7676 /// The complete set of object currently in memory (either active or released) excluding transient instance
7677 static TObjectCache _ObjectCache
;
7678 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
7679 static TReleasedObject _ReleasedObject
;
7681 /// The current object state
7682 NOPE::TObjectState _ObjectState
;
7684 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
7685 time_t _ReleaseDate
;
7687 /// The linked list of pointer on this object
7688 CJournalEntryPtr
*_PtrList
;
7690 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
7691 static CJournalEntry
*loadFromCache(uint32 objectId
, bool unrelease
);
7693 // Receive and execute command from the cache manager.
7694 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
7698 static void updateCache();
7701 static void clearCache();
7703 void registerUpdatable();
7705 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
7706 void setFirstPtr(CJournalEntryPtr
*ptr
);
7708 // return the first pointer of the pointer list (can be null)
7709 CJournalEntryPtr
*getFirstPtr()
7716 /** Return the object identifier (witch is unique)
7717 * You can only call this method on a persistent instance.
7718 * (because transient instance can have invalid id)
7720 uint32
getObjectId() const
7723 nlassert(getPersistentState() != NOPE::os_transient
);
7727 /** Set the object unique ID.
7728 * You can only set the object id on a transient object
7729 * having a non autogenerated unique id.
7730 * Furthermore, you MUST set the id before calling create()
7731 * if the id is not autogenerated.
7733 void setObjectId(uint32 objectId
)
7735 // can only be set when in transient state
7736 nlassert(getPersistentState() == NOPE::os_transient
);
7737 // can only be set once
7738 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
7742 /** Return the current persistent state of the object.*/
7743 NOPE::TObjectState
getPersistentState() const
7745 return _ObjectState
;
7749 // Set the persistent state of the object and do some house keeping
7750 void setPersistentState(NOPE::TObjectState state
);
7757 /////////////////////////////////////////////////////////////////
7758 // WARNING : this is a generated file, don't change it !
7759 /////////////////////////////////////////////////////////////////
7770 std::string _Comments
;
7772 friend class CFolderAccess
;
7774 std::vector
< CFolderAccessPtr
> *_FolderAccess
;
7776 friend class CSession
;
7778 std::vector
< CSessionPtr
> *_Sessions
;
7781 uint32
getAuthor() const
7786 void setAuthor(uint32 value
)
7789 if (_Author
!= value
)
7791 if (getPersistentState() != NOPE::os_transient
)
7792 setPersistentState(NOPE::os_dirty
);
7800 const std::string
&getTitle() const
7807 void setTitle(const std::string
&value
)
7810 if (_Title
!= value
)
7812 if (getPersistentState() != NOPE::os_transient
)
7813 setPersistentState(NOPE::os_dirty
);
7823 const std::string
&getComments() const
7830 void setComments(const std::string
&value
)
7833 if (_Comments
!= value
)
7835 if (getPersistentState() != NOPE::os_transient
)
7836 setPersistentState(NOPE::os_dirty
);
7846 /** Return a const reference to the vector of child.
7847 * If you want to modify the element inside, you need to
7848 * use on of the two following methods who return non const pointer
7849 * on contained elements.
7851 const std::vector
<CFolderAccessPtr
> &getFolderAccess() const;
7852 /** Return the ith element of the child vector
7853 * index must be valid (ie less than size of the vector)
7855 CFolderAccessPtr
&getFolderAccessByIndex(uint32 index
) const;
7856 /** Return the identified element by looking in the vector
7857 * If no element match the id, NULL pointer is returned
7859 CFolderAccessPtr
&getFolderAccessById(uint32 id
) const;
7862 /** Return a const reference to the vector of child.
7863 * If you want to modify the element inside, you need to
7864 * use on of the two following methods who return non const pointer
7865 * on contained elements.
7867 const std::vector
<CSessionPtr
> &getSessions() const;
7868 /** Return the ith element of the child vector
7869 * index must be valid (ie less than size of the vector)
7871 CSessionPtr
&getSessionsByIndex(uint32 index
) const;
7872 /** Return the identified element by looking in the vector
7873 * If no element match the id, NULL pointer is returned
7875 CSessionPtr
&getSessionsById(uint32 id
) const;
7878 bool operator == (const CFolder
&other
) const
7880 return _Id
== other
._Id
7881 && _Author
== other
._Author
7882 && _Title
== other
._Title
7883 && _Comments
== other
._Comments
;
7888 // private constructor, you must use 'createTransient' to get an instance
7891 _ObjectState(NOPE::os_transient
),
7892 _Id(NOPE::INVALID_OBJECT_ID
)
7894 _FolderAccess
= NULL
;
7897 // register the cache for this class (if not already done)
7898 registerUpdatable();
7901 // Destructor, delete any children
7904 /// utility func to remove this object from the released object container
7905 void removeFromReleased();
7909 /// Create a new instance in the transient space
7910 static CFolderPtr
createTransient(const char *filename
, uint32 lineNum
)
7912 return CFolderPtr(new CFolder(), filename
, lineNum
);
7915 /** Create a new object in the database from the current object data.
7916 * The object MUST be in transient state (i.e, it must be a new
7917 * object created by user and not comming from the databse).
7918 * If identifier is autogenerated, the generated id can be read after
7921 bool create(MSW::CConnection
&connection
);
7922 /** Update the database with the current object state.
7923 * The object MUST be either in clean or dirty state.
7924 * Return true if the object has been effectively stored
7926 * After this call, the object is in 'clean' state.
7928 bool update(MSW::CConnection
&connection
);
7929 /** Remove the current object from the persistent storage.
7930 * The object must be in clean or dirty state.
7931 * Return true if the object has been correctly
7932 * updated in the database.
7933 * After the call, the object is in 'clean' state.
7935 bool remove(MSW::CConnection
&connection
);
7936 /** Remove an object from the persistent storage by specifying
7938 * Return true if an entry as been effectively removed from
7940 * After the call, the object is in 'removed' state and should
7941 * no more be used. A good pratice should be to delete
7942 * the transient object just after the remove call.
7944 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
7946 /** Load an instance from the database.
7947 * This call allocate a new object and load the property value
7948 * from the database.
7949 * Return NULL if the object id is not found.
7951 static CFolderPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
7954 /** Load all objects children of CRingUser and
7955 * return them by using the specified output iterator.
7958 static bool loadChildrenOfCRingUser(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CFolderPtr
> &children
, const char *filename
, uint32 lineNum
);
7960 /// Load FolderAccess child(ren) object(s).
7961 bool loadFolderAccess(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
7963 /// Load Sessions child(ren) object(s).
7964 bool loadSessions(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
7970 friend class CPersistentCache
;
7971 friend class CFolderPtr
;
7973 typedef std::map
<uint32
, CFolder
*> TObjectCache
;
7974 typedef std::set
<CFolder
*> TObjectSet
;
7975 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
7977 /// The complete set of object currently in memory (either active or released) excluding transient instance
7978 static TObjectCache _ObjectCache
;
7979 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
7980 static TReleasedObject _ReleasedObject
;
7982 /// The current object state
7983 NOPE::TObjectState _ObjectState
;
7985 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
7986 time_t _ReleaseDate
;
7988 /// The linked list of pointer on this object
7989 CFolderPtr
*_PtrList
;
7991 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
7992 static CFolder
*loadFromCache(uint32 objectId
, bool unrelease
);
7994 // Receive and execute command from the cache manager.
7995 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
7999 static void updateCache();
8002 static void clearCache();
8004 void registerUpdatable();
8006 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
8007 void setFirstPtr(CFolderPtr
*ptr
);
8009 // return the first pointer of the pointer list (can be null)
8010 CFolderPtr
*getFirstPtr()
8017 /** Return the object identifier (witch is unique)
8018 * You can only call this method on a persistent instance.
8019 * (because transient instance can have invalid id)
8021 uint32
getObjectId() const
8024 nlassert(getPersistentState() != NOPE::os_transient
);
8028 /** Set the object unique ID.
8029 * You can only set the object id on a transient object
8030 * having a non autogenerated unique id.
8031 * Furthermore, you MUST set the id before calling create()
8032 * if the id is not autogenerated.
8034 void setObjectId(uint32 objectId
)
8036 // can only be set when in transient state
8037 nlassert(getPersistentState() == NOPE::os_transient
);
8038 // can only be set once
8039 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
8043 /** Return the current persistent state of the object.*/
8044 NOPE::TObjectState
getPersistentState() const
8046 return _ObjectState
;
8050 // Set the persistent state of the object and do some house keeping
8051 void setPersistentState(NOPE::TObjectState state
);
8058 /////////////////////////////////////////////////////////////////
8059 // WARNING : this is a generated file, don't change it !
8060 /////////////////////////////////////////////////////////////////
8072 uint32
getFolderId() const
8077 void setFolderId(uint32 value
)
8080 if (_FolderId
!= value
)
8082 if (getPersistentState() != NOPE::os_transient
)
8083 setPersistentState(NOPE::os_dirty
);
8091 uint32
getUserId() const
8096 void setUserId(uint32 value
)
8099 if (_UserId
!= value
)
8101 if (getPersistentState() != NOPE::os_transient
)
8102 setPersistentState(NOPE::os_dirty
);
8110 bool operator == (const CFolderAccess
&other
) const
8112 return _Id
== other
._Id
8113 && _FolderId
== other
._FolderId
8114 && _UserId
== other
._UserId
;
8119 // private constructor, you must use 'createTransient' to get an instance
8122 _ObjectState(NOPE::os_transient
),
8123 _Id(NOPE::INVALID_OBJECT_ID
)
8126 // register the cache for this class (if not already done)
8127 registerUpdatable();
8130 // Destructor, delete any children
8133 /// utility func to remove this object from the released object container
8134 void removeFromReleased();
8138 /// Create a new instance in the transient space
8139 static CFolderAccessPtr
createTransient(const char *filename
, uint32 lineNum
)
8141 return CFolderAccessPtr(new CFolderAccess(), filename
, lineNum
);
8144 /** Create a new object in the database from the current object data.
8145 * The object MUST be in transient state (i.e, it must be a new
8146 * object created by user and not comming from the databse).
8147 * If identifier is autogenerated, the generated id can be read after
8150 bool create(MSW::CConnection
&connection
);
8151 /** Update the database with the current object state.
8152 * The object MUST be either in clean or dirty state.
8153 * Return true if the object has been effectively stored
8155 * After this call, the object is in 'clean' state.
8157 bool update(MSW::CConnection
&connection
);
8158 /** Remove the current object from the persistent storage.
8159 * The object must be in clean or dirty state.
8160 * Return true if the object has been correctly
8161 * updated in the database.
8162 * After the call, the object is in 'clean' state.
8164 bool remove(MSW::CConnection
&connection
);
8165 /** Remove an object from the persistent storage by specifying
8167 * Return true if an entry as been effectively removed from
8169 * After the call, the object is in 'removed' state and should
8170 * no more be used. A good pratice should be to delete
8171 * the transient object just after the remove call.
8173 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
8175 /** Load an instance from the database.
8176 * This call allocate a new object and load the property value
8177 * from the database.
8178 * Return NULL if the object id is not found.
8180 static CFolderAccessPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
8183 /** Load all objects children of CRingUser and
8184 * return them by using the specified output iterator.
8187 static bool loadChildrenOfCRingUser(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CFolderAccessPtr
> &children
, const char *filename
, uint32 lineNum
);
8189 /** Load all objects children of CFolder and
8190 * return them by using the specified output iterator.
8193 static bool loadChildrenOfCFolder(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CFolderAccessPtr
> &children
, const char *filename
, uint32 lineNum
);
8199 friend class CPersistentCache
;
8200 friend class CFolderAccessPtr
;
8202 typedef std::map
<uint32
, CFolderAccess
*> TObjectCache
;
8203 typedef std::set
<CFolderAccess
*> TObjectSet
;
8204 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
8206 /// The complete set of object currently in memory (either active or released) excluding transient instance
8207 static TObjectCache _ObjectCache
;
8208 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
8209 static TReleasedObject _ReleasedObject
;
8211 /// The current object state
8212 NOPE::TObjectState _ObjectState
;
8214 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
8215 time_t _ReleaseDate
;
8217 /// The linked list of pointer on this object
8218 CFolderAccessPtr
*_PtrList
;
8220 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
8221 static CFolderAccess
*loadFromCache(uint32 objectId
, bool unrelease
);
8223 // Receive and execute command from the cache manager.
8224 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
8228 static void updateCache();
8231 static void clearCache();
8233 void registerUpdatable();
8235 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
8236 void setFirstPtr(CFolderAccessPtr
*ptr
);
8238 // return the first pointer of the pointer list (can be null)
8239 CFolderAccessPtr
*getFirstPtr()
8246 /** Return the object identifier (witch is unique)
8247 * You can only call this method on a persistent instance.
8248 * (because transient instance can have invalid id)
8250 uint32
getObjectId() const
8253 nlassert(getPersistentState() != NOPE::os_transient
);
8257 /** Set the object unique ID.
8258 * You can only set the object id on a transient object
8259 * having a non autogenerated unique id.
8260 * Furthermore, you MUST set the id before calling create()
8261 * if the id is not autogenerated.
8263 void setObjectId(uint32 objectId
)
8265 // can only be set when in transient state
8266 nlassert(getPersistentState() == NOPE::os_transient
);
8267 // can only be set once
8268 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
8272 /** Return the current persistent state of the object.*/
8273 NOPE::TObjectState
getPersistentState() const
8275 return _ObjectState
;
8279 // Set the persistent state of the object and do some house keeping
8280 void setPersistentState(NOPE::TObjectState state
);
8287 /////////////////////////////////////////////////////////////////
8288 // WARNING : this is a generated file, don't change it !
8289 /////////////////////////////////////////////////////////////////
8296 NLMISC::CHashKeyMD5 _MD5
;
8300 std::string _Description
;
8302 std::string _Author
;
8306 TAnimMode _AnimMode
;
8308 std::string _Language
;
8310 TSessionOrientation _Orientation
;
8312 R2::TSessionLevel _Level
;
8314 bool _AllowFreeTrial
;
8316 friend class CSessionLog
;
8318 std::vector
< CSessionLogPtr
> *_SessionLogs
;
8320 friend class CPlayerRating
;
8322 std::vector
< CPlayerRatingPtr
> *_PlayerRatings
;
8325 const NLMISC::CHashKeyMD5
&getMD5() const
8332 void setMD5(const NLMISC::CHashKeyMD5
&value
)
8337 if (getPersistentState() != NOPE::os_transient
)
8338 setPersistentState(NOPE::os_dirty
);
8348 const std::string
&getTitle() const
8355 void setTitle(const std::string
&value
)
8358 if (_Title
!= value
)
8360 if (getPersistentState() != NOPE::os_transient
)
8361 setPersistentState(NOPE::os_dirty
);
8371 const std::string
&getDescription() const
8373 return _Description
;
8378 void setDescription(const std::string
&value
)
8381 if (_Description
!= value
)
8383 if (getPersistentState() != NOPE::os_transient
)
8384 setPersistentState(NOPE::os_dirty
);
8387 _Description
= value
;
8394 const std::string
&getAuthor() const
8401 void setAuthor(const std::string
&value
)
8404 if (_Author
!= value
)
8406 if (getPersistentState() != NOPE::os_transient
)
8407 setPersistentState(NOPE::os_dirty
);
8417 uint32
getRRPTotal() const
8422 void setRRPTotal(uint32 value
)
8425 if (_RRPTotal
!= value
)
8427 if (getPersistentState() != NOPE::os_transient
)
8428 setPersistentState(NOPE::os_dirty
);
8436 TAnimMode
getAnimMode() const
8441 void setAnimMode(TAnimMode value
)
8444 if (_AnimMode
!= value
)
8446 if (getPersistentState() != NOPE::os_transient
)
8447 setPersistentState(NOPE::os_dirty
);
8455 const std::string
&getLanguage() const
8462 void setLanguage(const std::string
&value
)
8465 if (_Language
!= value
)
8467 if (getPersistentState() != NOPE::os_transient
)
8468 setPersistentState(NOPE::os_dirty
);
8478 TSessionOrientation
getOrientation() const
8480 return _Orientation
;
8483 void setOrientation(TSessionOrientation value
)
8486 if (_Orientation
!= value
)
8488 if (getPersistentState() != NOPE::os_transient
)
8489 setPersistentState(NOPE::os_dirty
);
8491 _Orientation
= value
;
8497 R2::TSessionLevel
getLevel() const
8502 void setLevel(R2::TSessionLevel value
)
8505 if (_Level
!= value
)
8507 if (getPersistentState() != NOPE::os_transient
)
8508 setPersistentState(NOPE::os_dirty
);
8516 bool getAllowFreeTrial() const
8518 return _AllowFreeTrial
;
8521 void setAllowFreeTrial(bool value
)
8524 if (_AllowFreeTrial
!= value
)
8526 if (getPersistentState() != NOPE::os_transient
)
8527 setPersistentState(NOPE::os_dirty
);
8529 _AllowFreeTrial
= value
;
8535 /** Return a const reference to the vector of child.
8536 * If you want to modify the element inside, you need to
8537 * use on of the two following methods who return non const pointer
8538 * on contained elements.
8540 const std::vector
<CSessionLogPtr
> &getSessionLogs() const;
8541 /** Return the ith element of the child vector
8542 * index must be valid (ie less than size of the vector)
8544 CSessionLogPtr
&getSessionLogsByIndex(uint32 index
) const;
8545 /** Return the identified element by looking in the vector
8546 * If no element match the id, NULL pointer is returned
8548 CSessionLogPtr
&getSessionLogsById(uint32 id
) const;
8551 /** Return a const reference to the vector of child.
8552 * If you want to modify the element inside, you need to
8553 * use on of the two following methods who return non const pointer
8554 * on contained elements.
8556 const std::vector
<CPlayerRatingPtr
> &getPlayerRatings() const;
8557 /** Return the ith element of the child vector
8558 * index must be valid (ie less than size of the vector)
8560 CPlayerRatingPtr
&getPlayerRatingsByIndex(uint32 index
) const;
8561 /** Return the identified element by looking in the vector
8562 * If no element match the id, NULL pointer is returned
8564 CPlayerRatingPtr
&getPlayerRatingsById(uint32 id
) const;
8567 bool operator == (const CScenario
&other
) const
8569 return _Id
== other
._Id
8570 && _MD5
== other
._MD5
8571 && _Title
== other
._Title
8572 && _Description
== other
._Description
8573 && _Author
== other
._Author
8574 && _RRPTotal
== other
._RRPTotal
8575 && _AnimMode
== other
._AnimMode
8576 && _Language
== other
._Language
8577 && _Orientation
== other
._Orientation
8578 && _Level
== other
._Level
8579 && _AllowFreeTrial
== other
._AllowFreeTrial
;
8584 // private constructor, you must use 'createTransient' to get an instance
8587 _ObjectState(NOPE::os_transient
),
8588 _Id(NOPE::INVALID_OBJECT_ID
)
8590 // Default initialisation
8592 _AllowFreeTrial
= false;
8593 _SessionLogs
= NULL
;
8594 _PlayerRatings
= NULL
;
8596 // register the cache for this class (if not already done)
8597 registerUpdatable();
8600 // Destructor, delete any children
8603 /// utility func to remove this object from the released object container
8604 void removeFromReleased();
8608 /// Create a new instance in the transient space
8609 static CScenarioPtr
createTransient(const char *filename
, uint32 lineNum
)
8611 return CScenarioPtr(new CScenario(), filename
, lineNum
);
8614 /** Create a new object in the database from the current object data.
8615 * The object MUST be in transient state (i.e, it must be a new
8616 * object created by user and not comming from the databse).
8617 * If identifier is autogenerated, the generated id can be read after
8620 bool create(MSW::CConnection
&connection
);
8621 /** Update the database with the current object state.
8622 * The object MUST be either in clean or dirty state.
8623 * Return true if the object has been effectively stored
8625 * After this call, the object is in 'clean' state.
8627 bool update(MSW::CConnection
&connection
);
8628 /** Remove the current object from the persistent storage.
8629 * The object must be in clean or dirty state.
8630 * Return true if the object has been correctly
8631 * updated in the database.
8632 * After the call, the object is in 'clean' state.
8634 bool remove(MSW::CConnection
&connection
);
8635 /** Remove an object from the persistent storage by specifying
8637 * Return true if an entry as been effectively removed from
8639 * After the call, the object is in 'removed' state and should
8640 * no more be used. A good pratice should be to delete
8641 * the transient object just after the remove call.
8643 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
8645 /** Load an instance from the database.
8646 * This call allocate a new object and load the property value
8647 * from the database.
8648 * Return NULL if the object id is not found.
8650 static CScenarioPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
8653 /// Load SessionLogs child(ren) object(s).
8654 bool loadSessionLogs(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
8656 /// Load PlayerRatings child(ren) object(s).
8657 bool loadPlayerRatings(MSW::CConnection
&connection
, const char *filename
, uint32 lineNum
);
8663 friend class CPersistentCache
;
8664 friend class CScenarioPtr
;
8666 typedef std::map
<uint32
, CScenario
*> TObjectCache
;
8667 typedef std::set
<CScenario
*> TObjectSet
;
8668 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
8670 /// The complete set of object currently in memory (either active or released) excluding transient instance
8671 static TObjectCache _ObjectCache
;
8672 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
8673 static TReleasedObject _ReleasedObject
;
8675 /// The current object state
8676 NOPE::TObjectState _ObjectState
;
8678 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
8679 time_t _ReleaseDate
;
8681 /// The linked list of pointer on this object
8682 CScenarioPtr
*_PtrList
;
8684 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
8685 static CScenario
*loadFromCache(uint32 objectId
, bool unrelease
);
8687 // Receive and execute command from the cache manager.
8688 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
8692 static void updateCache();
8695 static void clearCache();
8697 void registerUpdatable();
8699 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
8700 void setFirstPtr(CScenarioPtr
*ptr
);
8702 // return the first pointer of the pointer list (can be null)
8703 CScenarioPtr
*getFirstPtr()
8710 /** Return the object identifier (witch is unique)
8711 * You can only call this method on a persistent instance.
8712 * (because transient instance can have invalid id)
8714 uint32
getObjectId() const
8717 nlassert(getPersistentState() != NOPE::os_transient
);
8721 /** Set the object unique ID.
8722 * You can only set the object id on a transient object
8723 * having a non autogenerated unique id.
8724 * Furthermore, you MUST set the id before calling create()
8725 * if the id is not autogenerated.
8727 void setObjectId(uint32 objectId
)
8729 // can only be set when in transient state
8730 nlassert(getPersistentState() == NOPE::os_transient
);
8731 // can only be set once
8732 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
8736 /** Return the current persistent state of the object.*/
8737 NOPE::TObjectState
getPersistentState() const
8739 return _ObjectState
;
8743 // Set the persistent state of the object and do some house keeping
8744 void setPersistentState(NOPE::TObjectState state
);
8751 /////////////////////////////////////////////////////////////////
8752 // WARNING : this is a generated file, don't change it !
8753 /////////////////////////////////////////////////////////////////
8764 uint32 _ScenarioPointScored
;
8768 std::string _Participants
;
8774 std::string _GuildName
;
8777 uint32
getScenarioId() const
8782 void setScenarioId(uint32 value
)
8785 if (_ScenarioId
!= value
)
8787 if (getPersistentState() != NOPE::os_transient
)
8788 setPersistentState(NOPE::os_dirty
);
8790 _ScenarioId
= value
;
8796 uint32
getRRPScored() const
8801 void setRRPScored(uint32 value
)
8804 if (_RRPScored
!= value
)
8806 if (getPersistentState() != NOPE::os_transient
)
8807 setPersistentState(NOPE::os_dirty
);
8815 uint32
getScenarioPointScored() const
8817 return _ScenarioPointScored
;
8820 void setScenarioPointScored(uint32 value
)
8823 if (_ScenarioPointScored
!= value
)
8825 if (getPersistentState() != NOPE::os_transient
)
8826 setPersistentState(NOPE::os_dirty
);
8828 _ScenarioPointScored
= value
;
8834 uint32
getTimeTaken() const
8839 void setTimeTaken(uint32 value
)
8842 if (_TimeTaken
!= value
)
8844 if (getPersistentState() != NOPE::os_transient
)
8845 setPersistentState(NOPE::os_dirty
);
8853 const std::string
&getParticipants() const
8855 return _Participants
;
8860 void setParticipants(const std::string
&value
)
8863 if (_Participants
!= value
)
8865 if (getPersistentState() != NOPE::os_transient
)
8866 setPersistentState(NOPE::os_dirty
);
8869 _Participants
= value
;
8876 uint32
getLaunchDate() const
8881 void setLaunchDate(uint32 value
)
8884 if (_LaunchDate
!= value
)
8886 if (getPersistentState() != NOPE::os_transient
)
8887 setPersistentState(NOPE::os_dirty
);
8889 _LaunchDate
= value
;
8895 const std::string
&getOwner() const
8902 void setOwner(const std::string
&value
)
8905 if (_Owner
!= value
)
8907 if (getPersistentState() != NOPE::os_transient
)
8908 setPersistentState(NOPE::os_dirty
);
8918 const std::string
&getGuildName() const
8925 void setGuildName(const std::string
&value
)
8928 if (_GuildName
!= value
)
8930 if (getPersistentState() != NOPE::os_transient
)
8931 setPersistentState(NOPE::os_dirty
);
8941 bool operator == (const CSessionLog
&other
) const
8943 return _Id
== other
._Id
8944 && _ScenarioId
== other
._ScenarioId
8945 && _RRPScored
== other
._RRPScored
8946 && _ScenarioPointScored
== other
._ScenarioPointScored
8947 && _TimeTaken
== other
._TimeTaken
8948 && _Participants
== other
._Participants
8949 && _LaunchDate
== other
._LaunchDate
8950 && _Owner
== other
._Owner
8951 && _GuildName
== other
._GuildName
;
8956 // private constructor, you must use 'createTransient' to get an instance
8959 _ObjectState(NOPE::os_transient
),
8960 _Id(NOPE::INVALID_OBJECT_ID
)
8962 // Default initialisation
8964 _ScenarioPointScored
= 0;
8967 // register the cache for this class (if not already done)
8968 registerUpdatable();
8971 // Destructor, delete any children
8974 /// utility func to remove this object from the released object container
8975 void removeFromReleased();
8979 /// Create a new instance in the transient space
8980 static CSessionLogPtr
createTransient(const char *filename
, uint32 lineNum
)
8982 return CSessionLogPtr(new CSessionLog(), filename
, lineNum
);
8985 /** Create a new object in the database from the current object data.
8986 * The object MUST be in transient state (i.e, it must be a new
8987 * object created by user and not comming from the databse).
8988 * If identifier is autogenerated, the generated id can be read after
8991 bool create(MSW::CConnection
&connection
);
8992 /** Update the database with the current object state.
8993 * The object MUST be either in clean or dirty state.
8994 * Return true if the object has been effectively stored
8996 * After this call, the object is in 'clean' state.
8998 bool update(MSW::CConnection
&connection
);
8999 /** Remove the current object from the persistent storage.
9000 * The object must be in clean or dirty state.
9001 * Return true if the object has been correctly
9002 * updated in the database.
9003 * After the call, the object is in 'clean' state.
9005 bool remove(MSW::CConnection
&connection
);
9006 /** Remove an object from the persistent storage by specifying
9008 * Return true if an entry as been effectively removed from
9010 * After the call, the object is in 'removed' state and should
9011 * no more be used. A good pratice should be to delete
9012 * the transient object just after the remove call.
9014 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
9016 /** Load an instance from the database.
9017 * This call allocate a new object and load the property value
9018 * from the database.
9019 * Return NULL if the object id is not found.
9021 static CSessionLogPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
9024 /** Load all objects children of CScenario and
9025 * return them by using the specified output iterator.
9028 static bool loadChildrenOfCScenario(MSW::CConnection
&connection
, uint32 parentId
, std::vector
< CSessionLogPtr
> &children
, const char *filename
, uint32 lineNum
);
9034 friend class CPersistentCache
;
9035 friend class CSessionLogPtr
;
9037 typedef std::map
<uint32
, CSessionLog
*> TObjectCache
;
9038 typedef std::set
<CSessionLog
*> TObjectSet
;
9039 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
9041 /// The complete set of object currently in memory (either active or released) excluding transient instance
9042 static TObjectCache _ObjectCache
;
9043 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
9044 static TReleasedObject _ReleasedObject
;
9046 /// The current object state
9047 NOPE::TObjectState _ObjectState
;
9049 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
9050 time_t _ReleaseDate
;
9052 /// The linked list of pointer on this object
9053 CSessionLogPtr
*_PtrList
;
9055 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
9056 static CSessionLog
*loadFromCache(uint32 objectId
, bool unrelease
);
9058 // Receive and execute command from the cache manager.
9059 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
9063 static void updateCache();
9066 static void clearCache();
9068 void registerUpdatable();
9070 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
9071 void setFirstPtr(CSessionLogPtr
*ptr
);
9073 // return the first pointer of the pointer list (can be null)
9074 CSessionLogPtr
*getFirstPtr()
9081 /** Return the object identifier (witch is unique)
9082 * You can only call this method on a persistent instance.
9083 * (because transient instance can have invalid id)
9085 uint32
getObjectId() const
9091 /** Set the object unique ID.
9092 * You can only set the object id on a transient object
9093 * having a non autogenerated unique id.
9094 * Furthermore, you MUST set the id before calling create()
9095 * if the id is not autogenerated.
9097 void setObjectId(uint32 objectId
)
9099 // can only be set when in transient state
9100 nlassert(getPersistentState() == NOPE::os_transient
);
9101 // can only be set once
9102 nlassert(_Id
== NOPE::INVALID_OBJECT_ID
);
9106 /** Return the current persistent state of the object.*/
9107 NOPE::TObjectState
getPersistentState() const
9109 return _ObjectState
;
9113 // Set the persistent state of the object and do some house keeping
9114 void setPersistentState(NOPE::TObjectState state
);
9121 /////////////////////////////////////////////////////////////////
9122 // WARNING : this is a generated file, don't change it !
9123 /////////////////////////////////////////////////////////////////
9133 bool getAvailable() const
9138 void setAvailable(bool value
)
9141 if (_Available
!= value
)
9143 if (getPersistentState() != NOPE::os_transient
)
9144 setPersistentState(NOPE::os_dirty
);
9152 bool operator == (const CGmStatus
&other
) const
9154 return _UserId
== other
._UserId
9155 && _Available
== other
._Available
;
9160 // private constructor, you must use 'createTransient' to get an instance
9163 _ObjectState(NOPE::os_transient
),
9164 _UserId(NOPE::INVALID_OBJECT_ID
)
9166 // Default initialisation
9169 // register the cache for this class (if not already done)
9170 registerUpdatable();
9173 // Destructor, delete any children
9176 /// utility func to remove this object from the released object container
9177 void removeFromReleased();
9181 /// Create a new instance in the transient space
9182 static CGmStatusPtr
createTransient(const char *filename
, uint32 lineNum
)
9184 return CGmStatusPtr(new CGmStatus(), filename
, lineNum
);
9187 /** Create a new object in the database from the current object data.
9188 * The object MUST be in transient state (i.e, it must be a new
9189 * object created by user and not comming from the databse).
9190 * If identifier is autogenerated, the generated id can be read after
9193 bool create(MSW::CConnection
&connection
);
9194 /** Update the database with the current object state.
9195 * The object MUST be either in clean or dirty state.
9196 * Return true if the object has been effectively stored
9198 * After this call, the object is in 'clean' state.
9200 bool update(MSW::CConnection
&connection
);
9201 /** Remove the current object from the persistent storage.
9202 * The object must be in clean or dirty state.
9203 * Return true if the object has been correctly
9204 * updated in the database.
9205 * After the call, the object is in 'clean' state.
9207 bool remove(MSW::CConnection
&connection
);
9208 /** Remove an object from the persistent storage by specifying
9210 * Return true if an entry as been effectively removed from
9212 * After the call, the object is in 'removed' state and should
9213 * no more be used. A good pratice should be to delete
9214 * the transient object just after the remove call.
9216 static bool removeById(MSW::CConnection
&connection
, uint32 id
);
9218 /** Load an instance from the database.
9219 * This call allocate a new object and load the property value
9220 * from the database.
9221 * Return NULL if the object id is not found.
9223 static CGmStatusPtr
load(MSW::CConnection
&connection
, uint32 id
, const char *filename
, uint32 lineNum
);
9226 /** Load the object child of CRingUser and
9227 * return true if no error, false in case of error (in SQL maybe).
9228 * If no such object is found, fill the child pointer with NULL.
9230 static bool loadChildOfCRingUser(MSW::CConnection
&connection
, uint32 parentId
, CGmStatusPtr
&childPtr
, const char *filename
, uint32 lineNum
);
9236 friend class CPersistentCache
;
9237 friend class CGmStatusPtr
;
9239 typedef std::map
<uint32
, CGmStatus
*> TObjectCache
;
9240 typedef std::set
<CGmStatus
*> TObjectSet
;
9241 typedef std::map
<time_t, TObjectSet
> TReleasedObject
;
9243 /// The complete set of object currently in memory (either active or released) excluding transient instance
9244 static TObjectCache _ObjectCache
;
9245 /// The set of object in memory ut released (no pointer on them) and waiting for decommit
9246 static TReleasedObject _ReleasedObject
;
9248 /// The current object state
9249 NOPE::TObjectState _ObjectState
;
9251 /// For object in released state, this is the release date (used to trigger deletion of the object from memory)
9252 time_t _ReleaseDate
;
9254 /// The linked list of pointer on this object
9255 CGmStatusPtr
*_PtrList
;
9257 // Try to load the specified object from the memory cache, return NULL if the object is not in the cache
9258 static CGmStatus
*loadFromCache(uint32 objectId
, bool unrelease
);
9260 // Receive and execute command from the cache manager.
9261 static uint32
cacheCmd(NOPE::TCacheCmd cmd
);
9265 static void updateCache();
9268 static void clearCache();
9270 void registerUpdatable();
9272 // set the pointer on the first pointer of the pointer list (set to null when there is no more pointer)
9273 void setFirstPtr(CGmStatusPtr
*ptr
);
9275 // return the first pointer of the pointer list (can be null)
9276 CGmStatusPtr
*getFirstPtr()
9283 /** Return the object identifier (witch is unique)
9284 * You can only call this method on a persistent instance.
9285 * (because transient instance can have invalid id)
9287 uint32
getObjectId() const
9293 /** Set the object unique ID.
9294 * You can only set the object id on a transient object
9295 * having a non autogenerated unique id.
9296 * Furthermore, you MUST set the id before calling create()
9297 * if the id is not autogenerated.
9299 void setObjectId(uint32 objectId
)
9301 // can only be set when in transient state
9302 nlassert(getPersistentState() == NOPE::os_transient
);
9303 // can only be set once
9304 nlassert(_UserId
== NOPE::INVALID_OBJECT_ID
);
9308 /** Return the current persistent state of the object.*/
9309 NOPE::TObjectState
getPersistentState() const
9311 return _ObjectState
;
9315 // Set the persistent state of the object and do some house keeping
9316 void setPersistentState(NOPE::TObjectState state
);