Line data Source code
1 :
2 : /* Copyright (c) 2012-2015, Daniel Nachbaur <danielnachbaur@gmail.com>
3 : * Stefan.Eilemann@epfl.ch
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 : #include "masterCMCommand.h"
22 :
23 :
24 : namespace co
25 : {
26 :
27 : namespace detail
28 : {
29 :
30 : class MasterCMCommand
31 : {
32 : public:
33 46 : MasterCMCommand()
34 : : maxVersion( 0 )
35 : , requestID( 0 )
36 : , instanceID( CO_INSTANCE_INVALID )
37 : , masterInstanceID( CO_INSTANCE_INVALID )
38 46 : , useCache( false )
39 46 : {}
40 :
41 0 : MasterCMCommand( const MasterCMCommand& )
42 : : maxVersion( 0 )
43 : , requestID( 0 )
44 : , instanceID( CO_INSTANCE_INVALID )
45 : , masterInstanceID( CO_INSTANCE_INVALID )
46 0 : , useCache( false )
47 0 : {}
48 :
49 : uint128_t requestedVersion;
50 : uint128_t minCachedVersion;
51 : uint128_t maxCachedVersion;
52 : uint128_t objectID;
53 : uint64_t maxVersion;
54 : uint32_t requestID;
55 : uint32_t instanceID;
56 : uint32_t masterInstanceID;
57 : bool useCache;
58 : };
59 :
60 : }
61 :
62 46 : MasterCMCommand::MasterCMCommand( const ICommand& command )
63 : : ICommand( command )
64 46 : , _impl( new detail::MasterCMCommand )
65 : {
66 46 : _init();
67 46 : }
68 :
69 0 : MasterCMCommand::MasterCMCommand( const MasterCMCommand& rhs )
70 : : ICommand( rhs )
71 0 : , _impl( new detail::MasterCMCommand( *rhs._impl ))
72 : {
73 0 : _init();
74 0 : }
75 :
76 46 : void MasterCMCommand::_init()
77 : {
78 46 : if( isValid( ))
79 46 : *this >> _impl->requestedVersion >> _impl->minCachedVersion
80 92 : >> _impl->maxCachedVersion >> _impl->objectID >> _impl->maxVersion
81 92 : >> _impl->requestID >> _impl->instanceID
82 92 : >> _impl->masterInstanceID >> _impl->useCache;
83 46 : }
84 :
85 92 : MasterCMCommand::~MasterCMCommand()
86 : {
87 46 : delete _impl;
88 46 : }
89 :
90 80 : const uint128_t& MasterCMCommand::getRequestedVersion() const
91 : {
92 80 : return _impl->requestedVersion;
93 : }
94 :
95 30 : const uint128_t& MasterCMCommand::getMinCachedVersion() const
96 : {
97 30 : return _impl->minCachedVersion;
98 : }
99 :
100 34 : const uint128_t& MasterCMCommand::getMaxCachedVersion() const
101 : {
102 34 : return _impl->maxCachedVersion;
103 : }
104 :
105 134 : const uint128_t& MasterCMCommand::getObjectID() const
106 : {
107 134 : return _impl->objectID;
108 : }
109 :
110 34 : uint64_t MasterCMCommand::getMaxVersion() const
111 : {
112 34 : return _impl->maxVersion;
113 : }
114 :
115 92 : uint32_t MasterCMCommand::getRequestID() const
116 : {
117 92 : return _impl->requestID;
118 : }
119 :
120 126 : uint32_t MasterCMCommand::getInstanceID() const
121 : {
122 126 : return _impl->instanceID;
123 : }
124 :
125 4 : uint32_t MasterCMCommand::getMasterInstanceID() const
126 : {
127 4 : return _impl->masterInstanceID;
128 : }
129 :
130 88 : bool MasterCMCommand::useCache() const
131 : {
132 88 : return _impl->useCache;
133 : }
134 :
135 66 : }
|