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 8 : void init() override {}
40 :
41 : /** @name Versioning */
42 : //@{
43 0 : uint128_t getHeadVersion() const override { return VERSION_FIRST; }
44 1 : uint128_t getVersion() const override { return VERSION_FIRST; }
45 : //@}
46 :
47 32 : bool isMaster() const override { return false; }
48 8 : uint32_t getMasterInstanceID() const override
49 8 : { return CO_INSTANCE_INVALID; }
50 :
51 0 : bool addSlave( const MasterCMCommand& ) override
52 0 : { LBDONTCALL; return false; }
53 0 : void removeSlaves( NodePtr ) override {}
54 :
55 : void applyMapData( const uint128_t& version ) override;
56 : void addInstanceDatas( const ObjectDataIStreamDeque&,
57 : const uint128_t& startVersion ) override;
58 : protected:
59 : /** input stream for receiving the current version */
60 : ObjectDataIStream* _currentIStream;
61 :
62 : private:
63 : /* The command handlers. */
64 : bool _cmdInstance( ICommand& command );
65 16 : LB_TS_VAR( _rcvThread );
66 : };
67 : }
68 :
69 : #endif // CO_STATICSLAVECM_H
|