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