-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathFieldInstructionBitMap.cpp
More file actions
108 lines (95 loc) · 2.3 KB
/
Copy pathFieldInstructionBitMap.cpp
File metadata and controls
108 lines (95 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright (c) 2009, Object Computing, Inc.
// All rights reserved.
// See the file license.txt for licensing information.
#include <Common/QuickFASTPch.h>
#include "FieldInstructionBitMap.h"
#include <Codecs/DataSource.h>
#include <Codecs/Decoder.h>
#include <Codecs/DataDestination.h>
#include <Codecs/Encoder.h>
#include <Messages/Message.h>
#include <Messages/FieldBitMap.h>
#include <Common/Profiler.h>
using namespace ::QuickFAST;
using namespace ::QuickFAST::Codecs;
FieldInstructionBitMap::FieldInstructionBitMap(
const std::string & name,
const std::string & fieldNamespace)
: FieldInstruction(name, fieldNamespace)
{
initialValue_ = Messages::FieldBitMap::createNull();
}
FieldInstructionBitMap::FieldInstructionBitMap()
{
initialValue_ = Messages::FieldBitMap::createNull();
}
FieldInstructionBitMap::~FieldInstructionBitMap()
{
}
bool
FieldInstructionBitMap::decodeFromSource(
Codecs::DataSource & source,
bool mandatory,
WorkingBuffer & buffer,
Messages::FieldCPtr & field) const
{
int todo;
return false;
}
bool
FieldInstructionBitMap::decodeNop(
Codecs::DataSource & source,
Codecs::PresenceMap & pmap,
Codecs::Decoder & decoder,
Messages::DecodedFields & fieldSet) const
{
// note NOP never uses pmap. It uses a null value instead for optional fields
// so it's always safe to do the basic decode.
Messages::FieldCPtr field;
if(!decodeFromSource(source, isMandatory(), decoder.getWorkingBuffer(), field))
{
return false;
}
if(field)
{
fieldSet.addField(identity_, field);
}
return true;
}
void
FieldInstructionBitMap::encodeNop(
Codecs::DataDestination & destination,
Codecs::PresenceMap & pmap,
Codecs::Encoder & encoder,
const Messages::FieldSet & fieldSet) const
{
// get the value from the application data
Messages::FieldCPtr field;
if(fieldSet.getField(identity_->name(), field))
{
BitMap value = field->toBitMap();
#if 0
if(!isMandatory())
{
encodeNullableBitMap(destination, value);
}
else
{
encodeBitMap(destination, value);
}
}
else // not defined in fieldset
{
if(isMandatory())
{
encoder.reportFatal("[ERR U9]", "Missing mandatory field.");
}
destination.putByte(nullBitMap);
#endif
}
}
void
FieldInstructionBitMap::interpretValue(const std::string & value)
{
return;
}