Working on #2.

Built graph model, created header and cpp.
This commit is contained in:
Marcel Otte 2017-03-10 23:23:53 +01:00
parent c5127ec18e
commit af87acc86a
5 changed files with 247 additions and 23 deletions

View File

@ -243,10 +243,10 @@
<data key="d4"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="210.0" width="169.0" x="269.16666666666674" y="842.7739543726254"/>
<y:Geometry height="497.79677113010416" width="387.7255460588794" x="269.16666666666674" y="842.7739543726256"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="160.86328125" x="4.068359375" y="3.0">RandomAccessBinary<y:LabelModel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="160.86328125" x="113.4311324044397" y="3.0">RandomAccessBinary<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
@ -255,7 +255,32 @@
</y:NodeLabel>
<y:UML clipContent="true" constraint="" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel>- binaryData</y:AttributeLabel>
<y:MethodLabel/>
<y:MethodLabel>+ setBytes(uint position, std::vector&lt;uint8_t&gt; data)
+ setByte(uint position, uint8_t data)
+ setBit(uint64_t position, bool value)
+ setBit(uint bytePosition, uint bitPosition, bool value)
+ setBits(uint64_t position, uint bits, uint value)
+ setBits(uint bytePosition, uint bitPosition, uint bits, uint value)
+ getByte(uint position)
+ getBytes(uint position, uint bytes)
+ getBit(uint64_t position)
+ getBit(uint bytePosition, uint bitPosition)
+ getBits(uint64_t position, uint bits)
+ getBits(uint bytePosition, uint bitPosition, uint bits)
+ get_uint32(uint position)
+ get_uint16(uint position)
+ get_uint64(uint position)
+ get_float(uint position)
+ get_double(uint position)
+ get_string(uint position, uint length)
+ get_hex_string(uint position, uint length)
+ get_hex_string()</y:MethodLabel>
</y:UML>
</y:UMLClassNode>
</data>
@ -328,7 +353,6 @@
</node>
<node id="n14">
<data key="d4"/>
<data key="d5"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="217.0" width="184.5" x="36.333333333333485" y="839.2739543726256"/>
@ -371,7 +395,6 @@
</node>
<node id="n16">
<data key="d4"/>
<data key="d5"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="100.0" x="78.5833333333336" y="469.72604562737456"/>
@ -393,7 +416,6 @@
</node>
<node id="n17">
<data key="d4"/>
<data key="d5"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="100.0" x="303.66666666666686" y="476.059885931559"/>
@ -415,7 +437,6 @@
</node>
<node id="n18">
<data key="d4"/>
<data key="d5"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="100.0" x="509.4999999999999" y="476.059885931559"/>
@ -437,7 +458,6 @@
</node>
<node id="n19">
<data key="d4"/>
<data key="d5"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="100.0" x="-93.66666666666652" y="839.2739543726254"/>
@ -459,7 +479,6 @@
</node>
<node id="n20">
<data key="d4"/>
<data key="d5"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="146.0" x="-269.6666666666665" y="839.2739543726254"/>
@ -481,7 +500,6 @@
</node>
<node id="n21">
<data key="d4"/>
<data key="d5"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="146.0" x="-269.6666666666665" y="773.9573550380246"/>
@ -613,7 +631,6 @@
</edge>
<edge id="e10" source="n11" target="n14">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -625,7 +642,6 @@
</edge>
<edge id="e11" source="n14" target="n15">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -637,7 +653,6 @@
</edge>
<edge id="e12" source="n5" target="n14">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -649,7 +664,6 @@
</edge>
<edge id="e13" source="n0" target="n18">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -661,7 +675,6 @@
</edge>
<edge id="e14" source="n5" target="n17">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -673,7 +686,6 @@
</edge>
<edge id="e15" source="n11" target="n16">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -685,7 +697,6 @@
</edge>
<edge id="e16" source="n16" target="n13">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -697,7 +708,6 @@
</edge>
<edge id="e17" source="n17" target="n8">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -709,7 +719,6 @@
</edge>
<edge id="e18" source="n18" target="n9">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -721,7 +730,6 @@
</edge>
<edge id="e19" source="n14" target="n19">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -733,7 +741,6 @@
</edge>
<edge id="e20" source="n19" target="n20">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -745,7 +752,6 @@
</edge>
<edge id="e21" source="n20" target="n21">
<data key="d8"/>
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>

View File

@ -19,6 +19,8 @@ set(HEADERS
schemaio/AStructureWriterFactory.h
schemaio/AStructureReader.h
schemaio/AStructureWriter.h
RandomAccessBinary.h
)
set(SOURCES
@ -39,6 +41,8 @@ set(SOURCES
schemaio/AStructureWriterFactory.cpp
schemaio/AStructureReader.cpp
schemaio/AStructureWriter.cpp
RandomAccessBinary.cpp
)
add_library(core ${HEADERS} ${SOURCES})

View File

@ -0,0 +1,141 @@
#include "RandomAccessBinary.h"
RandomAccessBinary::RandomAccessBinary()
{
}
RandomAccessBinary::~RandomAccessBinary()
{
}
void RandomAccessBinary::setEndianess(RandomAccessBinary::Endianness endianess)
{
}
void RandomAccessBinary::setBytes(uint position, const std::vector<uint8_t> &data)
{
}
void RandomAccessBinary::setByte(uint position, const uint8_t &data)
{
}
void RandomAccessBinary::setBit(uint64_t position, const bool &value)
{
}
void RandomAccessBinary::setBit(uint bytePosition, uint bitPosition, const bool &value)
{
}
void RandomAccessBinary::setBits(uint64_t position, uint bits, const uint &value)
{
}
void RandomAccessBinary::setBits(uint bytePosition, uint bitPosition, const uint &value)
{
}
void RandomAccessBinary::set_uint16(uint position, uint16_t data)
{
}
void RandomAccessBinary::set_uint32(uint position, uint32_t data)
{
}
void RandomAccessBinary::set_uint64(uint position, uint64_t data)
{
}
void RandomAccessBinary::set_float(uint position, float data)
{
}
void RandomAccessBinary::set_double(uint position, double data)
{
}
const uint8_t RandomAccessBinary::getByte(uint position)
{
}
const std::vector<const uint8_t> RandomAccessBinary::getBytes(uint position, uint length)
{
}
const bool RandomAccessBinary::getBit(uint byteOffset, uint bitOffset)
{
}
const bool RandomAccessBinary::getBit(uint64_t position)
{
}
const std::vector<const uint8_t> RandomAccessBinary::getBits(uint byteOffset, uint8_t bitOffset, uint64_t length)
{
}
const std::vector<const uint8_t> RandomAccessBinary::getBits(uint64_t position, uint64_t length)
{
}
const uint16_t RandomAccessBinary::get_uint16(uint position)
{
}
const uint32_t RandomAccessBinary::get_uint32(uint position)
{
}
const uint64_t RandomAccessBinary::get_uint64(uint position)
{
}
const float RandomAccessBinary::get_float(uint position)
{
}
const double RandomAccessBinary::get_double(uint position)
{
}
std::__cxx11::string RandomAccessBinary::get_string(uint position, uint length)
{
}
std::__cxx11::string RandomAccessBinary::get_hex_string(uint position, uint length)
{
}
std::__cxx11::string RandomAccessBinary::get_hex_string()
{
}

View File

@ -0,0 +1,67 @@
#ifndef RANDOMACCESSBINARY_H
#define RANDOMACCESSBINARY_H
#include <list>
#include <memory>
#include <vector>
class RandomAccessBinary
{
enum class Endianness{
BIG,
LITTLE,
MIDDLE
};
public:
RandomAccessBinary();
explicit ~RandomAccessBinary();
void setEndianness(Endianness endianess);
const Endianness getEndianness();
void setBytes(uint position, const std::vector<uint8_t>& data);
void setByte(uint position, const uint8_t& data);
void setBit(uint64_t position, const bool& value);
void setBit(uint bytePosition, uint bitPosition, const bool& value);
void setBits(uint64_t position, uint bits, const uint& value);
void setBits(uint bytePosition, uint bitPosition, const uint& value);
void set_uint16(uint position, const uint16_t& data);
void set_uint32(uint position, const uint32_t& data);
void set_uint64(uint position, const uint64_t& data);
void set_float(uint position, const float& data);
void set_double(uint position, const double& data);
const uint8_t
getByte(uint position);
const std::vector<const uint8_t>
getBytes(uint position, uint length);
const bool getBit(uint byteOffset, uint bitOffset);
const bool getBit(uint64_t position);
const std::vector<const uint8_t>
getBits(uint byteOffset, uint8_t bitOffset, uint64_t length);
const std::vector<const uint8_t>
getBits(uint64_t position, uint64_t length);
const uint16_t get_uint16(uint position);
const uint32_t get_uint32(uint position);
const uint64_t get_uint64(uint position);
const float get_float(uint position);
const double get_double(uint position);
std::string get_string(uint position, uint length);
std::string get_hex_string(uint position, uint length);
std::string get_hex_string();
private:
std::unique_ptr<std::vector<uint8_t>> ptr_data;
};
#endif // RANDOMACCESSBINARY_H

View File

@ -1,11 +1,17 @@
#ifndef ASTRUCTURE_H
#define ASTRUCTURE_H
#include <memory>
#include <list>
#include "AField.h"
class AStructure
{
public:
AStructure();
private:
std::list<std::shared_ptr<AField>> fields;
};
#endif // ASTRUCTURE_H