Line data Source code
1 :
2 : /* Copyright (c) 2011-2013, Stefan Eilemann <eile@eyescale.ch>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #include "objectMap.h"
19 :
20 : #include <co/dataIStream.h>
21 : #include <co/dataOStream.h>
22 : #include <eq/config.h>
23 :
24 : namespace seq
25 : {
26 : namespace detail
27 : {
28 3 : ObjectMap::ObjectMap(eq::Config& config, co::ObjectFactory& factory)
29 3 : : co::ObjectMap(config, factory)
30 : {
31 3 : }
32 :
33 6 : ObjectMap::~ObjectMap()
34 : {
35 6 : }
36 :
37 1 : void ObjectMap::serialize(co::DataOStream& os, const uint64_t dirtyBits)
38 : {
39 1 : co::ObjectMap::serialize(os, dirtyBits);
40 :
41 1 : if (dirtyBits & DIRTY_INITDATA)
42 1 : os << _initData;
43 1 : if (dirtyBits & DIRTY_FRAMEDATA)
44 1 : os << _frameData;
45 1 : }
46 :
47 2 : void ObjectMap::deserialize(co::DataIStream& is, const uint64_t dirtyBits)
48 : {
49 2 : co::ObjectMap::deserialize(is, dirtyBits);
50 :
51 2 : if (dirtyBits & DIRTY_INITDATA)
52 2 : is >> _initData;
53 2 : if (dirtyBits & DIRTY_FRAMEDATA)
54 2 : is >> _frameData;
55 2 : }
56 :
57 1 : void ObjectMap::setInitData(co::Object* object)
58 : {
59 1 : const uint128_t identifier = object ? object->getID() : uint128_t();
60 1 : if (_initData == identifier)
61 1 : return;
62 :
63 0 : _initData = identifier;
64 0 : setDirty(DIRTY_INITDATA);
65 : }
66 :
67 1 : void ObjectMap::setFrameData(co::Object* object)
68 : {
69 1 : const uint128_t identifier = object ? object->getID() : uint128_t();
70 1 : if (_frameData == identifier)
71 1 : return;
72 :
73 0 : _frameData = identifier;
74 0 : setDirty(DIRTY_FRAMEDATA);
75 : }
76 : }
77 30 : }
|