client-cpp  0.10.0
LogBucket.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 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 LOGBUCKET_HPP_
18 #define LOGBUCKET_HPP_
19 
20 #include <list>
21 #include <cstdint>
22 #include <utility>
23 
24 #include "kaa/log/LogRecord.hpp"
25 
26 namespace kaa {
27 
33 class LogBucket {
34 public:
35 
39  LogBucket() {}
40 
47  LogBucket(std::int32_t id, std::list<LogRecord>&& records)
48  : id_(id), logRecords_(std::move(records)) { }
49 
56  LogBucket(std::int32_t id, const std::list<LogRecord>& records)
57  : id_(id), logRecords_(records) { }
58 
66  std::int32_t getBucketId() const {
67  return id_;
68  }
69 
75  std::list<LogRecord>& getRecords() {
76  return logRecords_;
77  }
78 
79 private:
80  std::int32_t id_ = 0;
81  std::list<LogRecord> logRecords_;
82 };
83 
84 } /* namespace kaa */
85 
86 #endif /* LOGBUCKET_HPP_ */
The helper class which is used to transfer logs from LogStorage to LogCollector.
Definition: LogBucket.hpp:33
std::list< LogRecord > & getRecords()
Returns log records of the bucket.
Definition: LogBucket.hpp:75
LogBucket(std::int32_t id, const std::list< LogRecord > &records)
Constructs LogBucket object.
Definition: LogBucket.hpp:56
LogBucket(std::int32_t id, std::list< LogRecord > &&records)
Constructs LogBucket object.
Definition: LogBucket.hpp:47
LogBucket()
Constructs empty LogBucket object.
Definition: LogBucket.hpp:39
std::int32_t getBucketId() const
Returns a log bucket id.
Definition: LogBucket.hpp:66