X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8c6fa3fbaccc22127280bf77a48fab5a3ee0716e..46b0747592074017ff0ea4b33d4a7194235886e5:/stargazer/plugins/other/smux/types.h diff --git a/stargazer/plugins/other/smux/types.h b/stargazer/plugins/other/smux/types.h new file mode 100644 index 00000000..2b54f2a2 --- /dev/null +++ b/stargazer/plugins/other/smux/types.h @@ -0,0 +1,57 @@ +#ifndef __TYPES_H__ +#define __TYPES_H__ + +#include +#include +#include + +#include "stg/OBJECT_IDENTIFIER.h" + +class OID { + public: + explicit OID(const std::string & str); + OID(const char * str, size_t length); + explicit OID(const std::vector & arcs); + OID(const unsigned * arcs, size_t length); + explicit OID(OBJECT_IDENTIFIER_t * oid); + OID(const OID & rvalue); + ~OID(); + + bool addSuffix(const char * suffix, size_t length); + bool addSuffix(const std::string & suffix); + bool addSuffix(const unsigned * suffix, size_t length); + bool addSuffix(const std::vector & suffix); + bool addSuffix(unsigned a, unsigned b); + + OID copyWithSuffix(const char * suffix, size_t length) const; + OID copyWithSuffix(const std::string & suffix) const; + OID copyWithSuffix(const unsigned * suffix, size_t length) const; + OID copyWithSuffix(const std::vector & suffix) const; + OID copyWithSuffix(unsigned a, unsigned b) const; + + std::string ToString() const; + const std::vector & ToVector() const { return arcs; } + void ToOID(OBJECT_IDENTIFIER_t * oid) const; + + OID & operator=(const OID & rvalue); + bool operator==(const OID & rvalue) const; + bool operator!=(const OID & rvalue) const { return !operator==(rvalue); } + bool operator<(const OID & rvalue) const; + bool operator>(const OID & rvalue) const + { return !operator==(rvalue) && !operator<(rvalue); } + + bool PrefixLess(const OID & rvalue) const; + + friend std::ostream & operator<<(std::ostream & stream, const OID & oid); + + private: + std::vector arcs; +}; + +inline +bool PrefixLess(const OID & a, const OID & b) +{ +return a.PrefixLess(b); +} + +#endif