Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl #63 #98

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

impl #63 #98

wants to merge 7 commits into from

Conversation

JohannesKauffmann
Copy link
Collaborator

TODO:

  • rework the commits
  • add unit tests

Ideally, this would depend on #50...

Added ISegment and DataSegment base classes, and concrete ANSI Extented
Symbol Segment implementation.

ISegment:
- add: Abstract base class which provides segment types and methods to
concrete segments.

DataSegment:
- add: Abstract class, extends from ISegment. Provides DataSegment
subtypes to concrete DataSegment implementations.

ANSISegment:
- Add: Concrete DataSegment implementation, provides functionality for
encoding ANSI data.

EPath:
- add: Constructor which takes a collection of segments to be requested.
- add: member which stores the segment collection.
- chg: packPaddedPath() and getSizeInWords() check to see if the segment
member is empty. If not, packPaddedPath() encodes the segment collection
instead of class/object/attribute id, and getSizeInWords() calculates
the size of the segment collection instead of the id's.
{ANSI,Data}Segment/EPath:
- Fixed some stylistic issues

LogicalSegment:
- Added LogicalSegment abstract class which inherits from ISegment and
contains enums for the logical type bits and logical format bits.

MemberIDSegment:
- Added concrete MemberIDSegment class which inherits from
LogicalSegment and implements encoding a Member ID logical value as
either 8bit or 16bit.
EPath:
- add: Added documentation of functions to header file.
- chg: toString() now prints all segments when needed.
- chg: expandPaddedPath doesn't try to decode the given vector when the
EPath consists of a collection of segments.
- fix: Initialize all member variables in every constructor.

ISegment:
- add: virtual function to calculate the segment header, and virtual
function to stringify the segment data.

MemberIDSegment:
- fix: Previously, the 16bit format was set in the constructor, even
when the 8bit format was indicated.
- impl: getSegmentHeader() and toString() function.

ANSISegment:
- impl: getSegmentHeader() and toString() function.
ISegment:
- add: Added documentation to the protected contructor and _data member
variable as to their usages.
- chg: The encode() method and getSize() method are now called data()
and size(), respectively, to represent their new roles. Their
implementations in the concrete ANSISegment and MemberIDSegment class
now just return the data and size, instead of doing complex encoding and
size calculations.

ANSISegment:
- chg: Constructor now encodes the data with header, size and optional
padding information instead of the renamed encode() method. The toString
method has been refactored to return the correct string.

MemberIDSegment:
- chg: Constructor now encodes the data with header and correct format
information instead of the renamed encode() method. The toString method
has been refactored to return the correct string.
ANSISegment:
fix: Previously, when the segment didn't hold any actual data, the
toString() function would crash trying to construct an empty string.
This was because the string is constructed from the beginning of the
data vector minus two bytes (for the header byte and length byte) to
the end of the data vector, minus a possible pad byte. When the data
length byte was zero, the check for the padding interpreted the last
byte as the pad byte, when this was the length byte, and thus an invalid
string would be constructed. Now, this case is checked at the beginning.
@nnarain
Copy link

nnarain commented Aug 9, 2023

Thank you for putting this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants