client-cpp  0.7.0
LogRecord.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LOGRECORD_HPP_
18 #define LOGRECORD_HPP_
19 
20 #include <memory>
21 #include <cstdint>
22 
23 #include "kaa/KaaThread.hpp"
24 #include "kaa/gen/EndpointGen.hpp"
27 
28 namespace kaa {
29 
30 class LogRecord {
31 public:
32  LogRecord(const KaaUserLogRecord& record)
33  {
34  AvroByteArrayConverter<KaaUserLogRecord> converter; // TODO: make converter thread local when it would be possible
35  converter.toByteArray(record, serializedLog_.data);
36  }
37 
38  const std::vector<std::uint8_t>& getData() const { return serializedLog_.data; }
39  size_t getSize() const { return serializedLog_.data.size(); }
40 
41  const LogEntry& getLogEntry() { return serializedLog_; }
42 
43 private:
44  LogEntry serializedLog_;
45 };
46 
47 typedef std::shared_ptr<LogRecord> LogRecordPtr;
48 
49 } // namespace kaa
50 
51 #endif /* LOGRECORD_HPP_ */
const std::vector< std::uint8_t > & getData() const
Definition: LogRecord.hpp:38
size_t getSize() const
Definition: LogRecord.hpp:39
const LogEntry & getLogEntry()
Definition: LogRecord.hpp:41
SharedDataBuffer toByteArray(const T &datum)
NOTE: THIS FILE IS AUTO-GENERATED. DO NOT EDIT IT MANUALLY.
std::shared_ptr< LogRecord > LogRecordPtr
Definition: ILogStorage.hpp:36
LogRecord(const KaaUserLogRecord &record)
Definition: LogRecord.hpp:32