1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_diameter_stack_Vendor_hpp
10 #define anna_diameter_stack_Vendor_hpp
13 #include <anna/config/defines.hpp>
14 #include <anna/diameter/defines.hpp>
16 #include <anna/config/defines.hpp>
17 #include <anna/core/RuntimeException.hpp>
18 #include <anna/core/define.autoenum.hpp>
40 //------------------------------------------------------------------------------
41 //----------------------------------------------------------------- class Vendor
42 //------------------------------------------------------------------------------
44 * Vendor data container
54 None = -1, // Initialized
63 anna_declare_enum(Code);
67 * @param v Vendor code
70 static const char* asText(const Code::_v v) throw(anna::RuntimeException) {
81 S32 getId(void) const throw() { return a_id; }
82 const S8 * getName(void) const throw() { return a_name.c_str(); }
85 bool isVendorSpecific(void) const throw() { return (a_id > 0); }
88 std::string asString(void) const throw();
89 anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
92 friend bool operator == (const Vendor & v1, const Vendor & v2) { return ((v1.getId() == v2.getId())); }
95 void setId(const S32 & id) throw(anna::RuntimeException) {
96 if(id < 0) throw anna::RuntimeException("Negative vendor-id not allowed", ANNA_FILE_LOCATION);
101 void setName(const std::string & n) throw(anna::RuntimeException) {
102 if(n == "") throw anna::RuntimeException("Empty vendor-name string not allowed", ANNA_FILE_LOCATION);