Remove dynamic exceptions
[anna.git] / include / anna / diameter / stack / Dictionary.hpp
index e5eece2..cbb8ee2 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// http://redmine.teslayout.com/projects/anna-suite
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     *  Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-//          cisco.tierra@gmail.com
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
 
 
 #ifndef anna_diameter_stack_Dictionary_hpp
@@ -110,10 +82,12 @@ public:
   typedef std::map<CommandId, Command, lessCommand> command_container;
   typedef command_container::const_iterator const_command_iterator;
 
+protected:
+  std::string a_name;
+
 private:
 
   bool a_allowUpdates;
-  std::string a_name;
   format_container a_formats;
   vendor_container a_vendors;
   avp_container a_avps;
@@ -138,14 +112,14 @@ private:
 
 
   // init
-  void initialize() throw();
+  void initialize() ;
 
   // check & addings
-  //void checkUniqueIdentifiers(const anna::xml::Node *rootNode) const throw(anna::RuntimeException);
-  void extractFormats(const anna::xml::Node *rootNode) throw(anna::RuntimeException);
-  void extractVendors(const anna::xml::Node *rootNode) throw(anna::RuntimeException);
-  void extractAvps(const anna::xml::Node *rootNode) throw(anna::RuntimeException);
-  void extractCommands(const anna::xml::Node *rootNode) throw(anna::RuntimeException);
+  //void checkUniqueIdentifiers(const anna::xml::Node *rootNode) const noexcept(false);
+  void extractFormats(const anna::xml::Node *rootNode) noexcept(false);
+  void extractVendors(const anna::xml::Node *rootNode) noexcept(false);
+  void extractAvps(const anna::xml::Node *rootNode) noexcept(false);
+  void extractCommands(const anna::xml::Node *rootNode) noexcept(false);
 
 public:
 
@@ -153,38 +127,38 @@ public:
   ~Dictionary() {};
 
   // get
-  const std::string & getName() const throw() { return a_name; }
-  const Format * getFormat(const std::string & formatName) const throw();
-  const Vendor * getVendor(S32 vendorId) const throw();
-  const Vendor * getVendor(const std::string & vendorName) const throw();
-  const Avp * getAvp(const AvpId & avpId) const throw();
-  const Avp * getAvp(const std::string & avpName) const throw();
-  const Command * getCommand(const CommandId & commandId) const throw();
-  const Command * getCommand(const std::string & commandName) const throw();
+  const std::string & getName() const { return a_name; }
+  const Format * getFormat(const std::string & formatName) const ;
+  const Vendor * getVendor(S32 vendorId) const ;
+  const Vendor * getVendor(const std::string & vendorName) const ;
+  const Avp * getAvp(const AvpId & avpId) const ;
+  const Avp * getAvp(const std::string & avpName) const ;
+  const Command * getCommand(const CommandId & commandId) const ;
+  const Command * getCommand(const std::string & commandName) const ;
 
   // set
-  void allowUpdates(bool allow = true) throw() { a_allowUpdates = allow; }
-  void addFormat(const Format &, bool reserved = false) throw(anna::RuntimeException);
-  void addVendor(const Vendor &) throw(anna::RuntimeException);
-  void addAvp(const Avp &) throw(anna::RuntimeException);
-  void addCommand(const Command &) throw(anna::RuntimeException);
+  void allowUpdates(bool allow = true) { a_allowUpdates = allow; }
+  void addFormat(const Format &, bool reserved = false) noexcept(false);
+  void addVendor(const Vendor &) noexcept(false);
+  void addAvp(const Avp &) noexcept(false);
+  void addCommand(const Command &) noexcept(false);
 
   // containers
-  const_format_iterator format_begin() const throw() { return a_formats.begin(); }
-  const_format_iterator format_end() const throw() { return a_formats.end(); }
-  int format_size() const throw() { return a_formats.size(); }
+  const_format_iterator format_begin() const { return a_formats.begin(); }
+  const_format_iterator format_end() const { return a_formats.end(); }
+  int format_size() const { return a_formats.size(); }
 
-  const_vendor_iterator vendor_begin() const throw() { return a_vendors.begin(); }
-  const_vendor_iterator vendor_end() const throw() { return a_vendors.end(); }
-  int vendor_size() const throw() { return a_vendors.size(); }
+  const_vendor_iterator vendor_begin() const { return a_vendors.begin(); }
+  const_vendor_iterator vendor_end() const { return a_vendors.end(); }
+  int vendor_size() const { return a_vendors.size(); }
 
-  const_avp_iterator avp_begin() const throw() { return a_avps.begin(); }
-  const_avp_iterator avp_end() const throw() { return a_avps.end(); }
-  int avp_size() const throw() { return a_avps.size(); }
+  const_avp_iterator avp_begin() const { return a_avps.begin(); }
+  const_avp_iterator avp_end() const { return a_avps.end(); }
+  int avp_size() const { return a_avps.size(); }
 
-  const_command_iterator command_begin() const throw() { return a_commands.begin(); }
-  const_command_iterator command_end() const throw() { return a_commands.end(); }
-  int command_size() const throw() { return a_commands.size(); }
+  const_command_iterator command_begin() const { return a_commands.begin(); }
+  const_command_iterator command_end() const { return a_commands.end(); }
+  int command_size() const { return a_commands.size(); }
 
 
   // helpers
@@ -193,20 +167,20 @@ public:
   *
   * @return String with class content
   */
-  std::string asString(void) const throw();
+  std::string asString(void) const ;
 
   /**
      Class XML representation.
      \param parent XML node over which we will put instance information.
      \return XML documentcon with class content.
   */
-  anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
+  anna::xml::Node* asXML(anna::xml::Node* parent) const ;
 
   /**
      Class XML string representation
      \return XML string representation with class content.
   */
-  std::string asXMLString() const throw();
+  std::string asXMLString() const ;
 
   // operators
 
@@ -221,7 +195,7 @@ public:
   * and stack-specific commands in other set of xml files. Application only would have to load common part for all
   * the created dictionaries with this method and specific one for each final dictionary:
   *
-  * @param xmlPathFile Path file to the xml document which represents the diameter dictionary.
+  * @param pathFile Path file to the xml document which represents the diameter dictionary.
   *
   * <pre>
   * Dictionary *nokiaStack = stackEngine.createDictionary("/var/tmp/vendors_and_avps.xml", NOKIA_STACK_ID);
@@ -230,12 +204,12 @@ public:
   * huaweiStack->load("/var/tmp/huawei_commands.xml");
   * </pre>
   */
-  void load(const std::string & xmlPathFile) throw(anna::RuntimeException);
+  virtual void load(const std::string & pathFile) noexcept(false);
 
   /**
   * Clears dictionary content
   */
-  void clear(void) throw() { initialize(); } // initialize and prepares the dictionary
+  void clear(void) { initialize(); } // initialize and prepares the dictionary
 };