Giter VIP home page Giter VIP logo

karljj1 / kdis Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 9.0 3.28 MB

DIS(IEEE 1278.1) Fully Implemented in C++. A complete open source implementation of DIS (Distributed Interactive Simulation) in C++. 1278.1 and 1278.1a are fully implemented including enumerations. Includes several utility classes to help with developing your DIS app.

License: BSD 2-Clause "Simplified" License

CMake 1.77% C++ 98.08% Shell 0.16%
data-formats simulation protocols cpp dis networking kdis

kdis's People

Contributors

buddavis avatar carlocorradini avatar dalemarchand avatar dependabot[bot] avatar fabausch avatar glanois avatar intothevoid avatar jimbo1969 avatar karljj1 avatar kdienes avatar olaughlj avatar psyinf avatar spitofland avatar tklasik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kdis's Issues

enum class instead of enum

KDIS has a lot of enums. To avoid pollution (like C) it's suggested to use enum class instead of enum

Clone PDU

We need a method/mechanism to clone the PDU:

  1. From the generic Header:
    • If Header is "pure" simply return a copy of the Header
    • If Header is the base class of a specialized PDU, clone the whole chain and return a copy of the Header (it can be casted to the correct PDU)
  2. From a specialized PDU, simply create a copy of the PDU (clone the whole chain)

@karljj1 I don't know if this is already possible but it's super useful (especially in my use-case)

Dead Reckoning Other Parameters

May I suggest that the two standard Dead Reckoning Other Parameters field formats are implemented as classes. This could use the methodologies used within the rest of the PDUs to convert from KDataStreams to the specific PDU structures.

The current SetQuatAxis and GetQuatAxis functions aren't implemented correctly as the storage of the Quaternion vector starts at memory location zero of the 15 octet array rather than at octet 4 of the array.

I've started an example class below.

class DrpParameters
{
protected:
KUINT8 m_uiDeadReckoningParameterType;
KOCTET m_Params[14];

public:
static const KUINT16 DEAD_RECKONING_OTHER_PARAMETER_SIZE = 15;
DrpParameters();
DrpParameters( KDataStream & stream);
DrpParameters(KDIS::DATA_TYPE::ENUMS::DeadReckoningParameters DRP, const KOCTECT & params);
virtual ~DrpParameters();

void SetDeadReckoningParemeter(KDIS::DATA_TYPE::ENUMS::DeadReckoningParameters DRP);
KDIS::DATA_TYPE::ENUMS::DeadReckoningParameters DRP GetDeadRockoningParameter() const;
virtual KString GetAsString() const;
virtual void Decode( KDataStream & stream ) ;
virtual KDataStream Encode() const;
virtual void Encode( KDataStream & stream ) const;
KBOOL operator == ( const DrpParameters& Value ) const;
KBOOL operator != ( const DrpParameters& Value ) const;

}

class LocalEulerAnglesDrpParameters : public DrpParameters
{
protected:
KUINT16 m_uiPadding; // unused
KFLOAT m_LocalYaw;
KFLOAT m_LocalPitch;
KFLOAT m_LocalRoll;

public:
LocalEulerAnglesDrpParameters ();
LocalEulerAnglesDrpParameters ( KDataStream & stream);
LocalEulerAnglesDrpParameters (KDIS::DATA_TYPE::ENUMS::DeadReckoningParameters DRP, const Vector & eulerAngles);
virtual ~LocalEulerAnglesDrpParameters ();

void SetEulerAngles( const Vector & LEA );
const Vector & GetEulerAngles() const;
Vector & GetEulerAngles();

virtual KString GetAsString() const;
virtual void Decode( KDataStream & stream ) ;
virtual KDataStream Encode() const;
virtual void Encode( KDataStream & stream ) const;
KBOOL operator == ( const LocalEulerAnglesDrpParameters & Value ) const;
KBOOL operator != ( const LocalEulerAnglesDrpParameters & Value ) const;
}

class QuarternionDrpParameters : public DrpParameters
{
protected:
KUINT16 m_uiQuartU0;
KFLOAT m_QuartUX;
KFLOAT m_QuartUY;
KFLOAT m_QuartUZ;

public:
QuarternionDrpParameters ();
QuarternionDrpParameters ( KDataStream & stream);
QuarternionDrpParameters (KDIS::DATA_TYPE::ENUMS::DeadReckoningParameters DRP, const Quart & Quart); // New Quaternion Type?
virtual ~QuarternionDrpParameters ();

void SetQuarternions( const QUART & Quart );
const Quart & GetQuarternions() const;
Quart & GetQuarternions();

virtual KString GetAsString() const;
virtual void Decode( KDataStream & stream ) ;
virtual KDataStream Encode() const;
virtual void Encode( KDataStream & stream ) const;
KBOOL operator == ( const QuarternionDrpParameters & Value ) const;
KBOOL operator != ( const QuarternionDrpParameters & Value ) const;
}

Connection builder pattern

Using the current constructor to create a Connection class is a little too verbose and tedious.
Additionally, although if some options can be modified after creation, some cannot (port).
I propose to modify the Connection class's creation process by utilizing the Builder Pattern:

const Connection connection = Connection::builder("1.2.3.4") // Automatically determine if address is multicast or not
                                 .port(3000) // Send/Receive port
                                 .interface("eth0") // Send/Receive interface
                                 .timeout(3, 0) // Send/Receive timeout
                                 .blocking(true)
                                 .factory(myFactory)
                                 .receiveAddress("1.2.3.4")
                                 .receivePort(12000)
                                 .receiveInterface("eth0") // Interface name
                                 .receiveTimeout(6, 0)
                                 .sendAddress("4.3.2.1")
                                 .sendPort(6000)
                                 .sendInterface("9.9.9.9") // Interface IP
                                 .sendInterface(0) // Interface index -> 0 is default interface
                                 .sendTimeout(12, 0)
                                 .receive(false) // Disable receive -> If both receive/send (after .build() call) are false throw error
                                 .send(false) // Disable send -> If both receive/send (after .build() call) are false throw error
                                 .addSubscriber(S0)
                                 .removeSubscriber(S0)
                                 .build();

connection.connect();
// ...
connection.disconnect();

What do yuo think? ๐Ÿฅณ

chore: move sources to root

Can we move everything from the KIDS directory to the root?
This results in a more uniform project structure overall, as well as the simplification of other "auto-tools" like CPM.

Update GitHub description

Update GitHub description from:

About
DIS(IEEE 1278.1) Fully Implemented in C++. A complete open source implementation of DIS (Distributed Interactive Simulation) in C++. 1278.1 and 1278.1a are fully implemented including enumerations. Includes several utility classes to help with developing your DIS app.

To:

Open source implementation of DIS (Distributed Interactive Simulation) IEEE 1278.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.