CFEL - ASG Software Suite  2.5.0
CASS
cass/processing/id_list.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010, 2015 Lutz Foucar
2 
3 /**
4  * @file cass/processing/id_list.cpp file contains the classes that can
5  * serialize the key list
6  *
7  * @author Stephan Kassemeyer
8  */
9 
10 
11 #include "id_list.h"
12 
13 #include "log.h"
14 
15 using namespace cass;
16 
18  : Serializable(1),
19  _list(list),
20  _size(list.size())
21 {
22  Log::add(Log::VERBOSEINFO,"IdList::IdList(): Initial list size = " +
23  toString(_size));
24 }
25 
27 {
29  writeVersion(out);
30  out.add(_size);
32  for (Processor::names_t::const_iterator it=_list.begin(); it!=_list.end(); it++)
33  out.add(*it);
34 }
35 
37 {
38  _list.clear();
39  //check whether the version fits//
41  checkVersion(in);
42  _size = in.retrieve<size_t>();
43  Log::add(Log::VERBOSEINFO,"IdList::deserialize(): list size " +
44  toString(_size));
45  if (!in.endChecksumGroupForRead())
46  {
47  Log::add(Log::VERBOSEINFO,"IdList::deserialize(): wrong checksum IdList");
48  return false;
49  }
50  for(size_t ii=0; ii<_size; ++ii)
51  _list.push_back(in.retrieve<std::string>());
52  Log::add(Log::VERBOSEINFO,"IdList::deserialize(): list is done ");
53  return true;
54 }
55 
57 {
58  _list.clear();
59  _size=0;
60 }
61 
63 {
64  clear();
65  _list = list;
66  _size = list.size();
67 }
Processor::names_t _list
a list of all processor keys
IdList()
default constructor
file contains the classes that can serialize the key list
void startChecksumGroupForWrite()
control checksum for writing to stream
Definition: serializer.hpp:135
virtual void writeVersion(SerializerBackend &out) const
write the version to the stream
void setList(const Processor::names_t &list)
copy the list to us
things written only at end of run H5Dump ProcessorSummary size
void serialize(SerializerBackend &out) const
serialize the list to the serializer
static void add(Level level, const std::string &line)
add a string to the log
Definition: log.cpp:31
size_t _size
the size of the processor keys list
std::list< name_t > names_t
define the list of names
Definition: processor.h:49
void startChecksumGroupForRead()
control checksum calculation for the next values added
Definition: serializer.hpp:106
virtual void checkVersion(SerializerBackend &in) const
check the version
bool deserialize(SerializerBackend &in)
deserialize the list from the serializer
std::string toString(const Type &t)
convert any type to a string
Definition: cass.h:63
void clear()
clear the list
Type retrieve()
read arbitrary value from stream
Definition: serializer.hpp:169
contains a logger for cass
Serializable.
void add(const Type &value)
add arbitrary value to the stream
Definition: serializer.hpp:158