Line data Source code
1 :
2 : /* Copyright (c) 2007-2014, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2011-2012, Daniel Nachbaur <danielnachbaur@gmail.com>
4 : *
5 : * This file is part of Collage <https://github.com/Eyescale/Collage>
6 : *
7 : * This library is free software; you can redistribute it and/or modify it under
8 : * the terms of the GNU Lesser General Public License version 2.1 as published
9 : * by the Free Software Foundation.
10 : *
11 : * This library is distributed in the hope that it will be useful, but WITHOUT
12 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 : * details.
15 : *
16 : * You should have received a copy of the GNU Lesser General Public License
17 : * along with this library; if not, write to the Free Software Foundation, Inc.,
18 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : */
20 :
21 : #ifndef CO_STATICSLAVECM_H
22 : #define CO_STATICSLAVECM_H
23 :
24 : #include "objectCM.h" // base class
25 : #include <co/objectVersion.h> // VERSION_FOO values
26 : #include <lunchbox/thread.h> // thread-safety check
27 :
28 : namespace co
29 : {
30 : /** @internal
31 : * An object change manager handling static object slave instances.
32 : */
33 : class StaticSlaveCM : public ObjectCM
34 : {
35 : public:
36 : explicit StaticSlaveCM(Object* object);
37 : virtual ~StaticSlaveCM();
38 :
39 2 : void init() override {}
40 : /** @name Versioning */
41 : //@{
42 0 : uint128_t getHeadVersion() const override { return VERSION_FIRST; }
43 1 : uint128_t getVersion() const override { return VERSION_FIRST; }
44 : //@}
45 :
46 8 : bool isMaster() const override { return false; }
47 2 : uint32_t getMasterInstanceID() const override
48 : {
49 2 : return CO_INSTANCE_INVALID;
50 : }
51 :
52 0 : bool addSlave(const MasterCMCommand&) override
53 : {
54 0 : LBDONTCALL;
55 0 : return false;
56 : }
57 0 : void removeSlaves(NodePtr) override {}
58 : void applyMapData(const uint128_t& version) override;
59 : void addInstanceDatas(const ObjectDataIStreamDeque&,
60 : const uint128_t& startVersion) override;
61 :
62 : protected:
63 : /** input stream for receiving the current version */
64 : ObjectDataIStream* _currentIStream;
65 :
66 : private:
67 : /* The command handlers. */
68 : bool _cmdInstance(ICommand& command);
69 4 : LB_TS_VAR(_rcvThread);
70 : };
71 : }
72 :
73 : #endif // CO_STATICSLAVECM_H
|