Line data Source code
1 :
2 : /* Copyright (c) 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This file is part of Collage <https://github.com/Eyescale/Collage>
5 : *
6 : * This library is free software; you can redistribute it and/or modify it under
7 : * the terms of the GNU Lesser General Public License version 2.1 as published
8 : * by the Free Software Foundation.
9 : *
10 : * This library is distributed in the hope that it will be useful, but WITHOUT
11 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 : * details.
14 : *
15 : * You should have received a copy of the GNU Lesser General Public License
16 : * along with this library; if not, write to the Free Software Foundation, Inc.,
17 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 : */
19 :
20 : #include "objectVersion.h"
21 :
22 : #include "object.h"
23 :
24 : namespace co
25 : {
26 12 : ObjectVersion::ObjectVersion()
27 12 : : version(VERSION_NONE)
28 : {
29 12 : }
30 :
31 185640 : ObjectVersion::ObjectVersion(const uint128_t& id_, const uint128_t& version_)
32 : : identifier(id_)
33 185640 : , version(version_)
34 : {
35 185640 : }
36 :
37 25 : ObjectVersion::ObjectVersion(const Object* object)
38 25 : : version(VERSION_NONE)
39 : {
40 25 : if (object && object->isAttached())
41 : {
42 25 : identifier = object->getID();
43 25 : version = object->getVersion();
44 : }
45 25 : }
46 :
47 2 : ObjectVersion::ObjectVersion(const Object& object)
48 2 : : identifier(object.getID())
49 2 : , version(object.getVersion())
50 : {
51 2 : }
52 :
53 0 : ObjectVersion& ObjectVersion::operator=(const Object* object)
54 : {
55 0 : if (object)
56 : {
57 0 : identifier = object->getID();
58 0 : version = object->getVersion();
59 : }
60 : else
61 : {
62 0 : identifier = 0;
63 0 : version = VERSION_NONE;
64 : }
65 :
66 0 : return *this;
67 : }
68 63 : }
|