[svn] commit: r3237 - in /branches/trac373/src: bin/auth/benchmarks/query_bench.cc lib/config/ccsession.cc lib/config/ccsession.h lib/config/config_data.h lib/config/module_spec.cc lib/config/module_spec.h

BIND 10 source code commits bind10-changes at lists.isc.org
Sun Oct 17 05:32:48 UTC 2010


Author: jinmei
Date: Sun Oct 17 05:32:48 2010
New Revision: 3237

Log:
removed 'using namespace' from src/lib/config/module_spec.cc, and adjusted other files accordingly.
for trac #373.

Modified:
    branches/trac373/src/bin/auth/benchmarks/query_bench.cc
    branches/trac373/src/lib/config/ccsession.cc
    branches/trac373/src/lib/config/ccsession.h
    branches/trac373/src/lib/config/config_data.h
    branches/trac373/src/lib/config/module_spec.cc
    branches/trac373/src/lib/config/module_spec.h

Modified: branches/trac373/src/bin/auth/benchmarks/query_bench.cc
==============================================================================
--- branches/trac373/src/bin/auth/benchmarks/query_bench.cc (original)
+++ branches/trac373/src/bin/auth/benchmarks/query_bench.cc Sun Oct 17 05:32:48 2010
@@ -38,6 +38,7 @@
 
 using namespace std;
 using namespace isc;
+using namespace isc::data;
 using namespace isc::dns;
 using namespace isc::xfr;
 using namespace isc::bench;

Modified: branches/trac373/src/lib/config/ccsession.cc
==============================================================================
--- branches/trac373/src/lib/config/ccsession.cc (original)
+++ branches/trac373/src/lib/config/ccsession.cc Sun Oct 17 05:32:48 2010
@@ -45,6 +45,7 @@
 using namespace std;
 
 using isc::data::Element;
+using isc::data::ConstElementPtr;
 using isc::data::ElementPtr;
 using isc::data::JSONError;
 

Modified: branches/trac373/src/lib/config/ccsession.h
==============================================================================
--- branches/trac373/src/lib/config/ccsession.h (original)
+++ branches/trac373/src/lib/config/ccsession.h Sun Oct 17 05:32:48 2010
@@ -31,7 +31,7 @@
 /// \brief Creates a standard config/command level success answer message
 ///        (i.e. of the form { "result": [ 0 ] }
 /// \return Standard command/config success answer message
-ConstElementPtr createAnswer();
+isc::data::ConstElementPtr createAnswer();
 
 ///
 /// \brief Creates a standard config/command level answer message
@@ -43,7 +43,8 @@
 ///            Element type. For rcode == 1, this argument is mandatory,
 ///            and must be a StringElement containing an error description
 /// \return Standard command/config answer message
-ConstElementPtr createAnswer(const int rcode, ConstElementPtr arg);
+isc::data::ConstElementPtr createAnswer(const int rcode,
+                                        isc::data::ConstElementPtr arg);
 
 ///
 /// \brief Creates a standard config/command level answer message
@@ -52,7 +53,8 @@
 /// \param rcode The return code (0 for success)
 /// \param arg A string to put into the StringElement argument
 /// \return Standard command/config answer message
-ConstElementPtr createAnswer(const int rcode, const std::string& arg);
+isc::data::ConstElementPtr createAnswer(const int rcode,
+                                        const std::string& arg);
 
 ///
 /// Parses a standard config/command level answer message
@@ -63,7 +65,8 @@
 /// \return The optional argument in the message, or an empty ElementPtr
 ///         if there was no argument. If rcode != 0, this contains a
 ///         StringElement with the error description.
-ConstElementPtr parseAnswer(int &rcode, ConstElementPtr msg);
+isc::data::ConstElementPtr parseAnswer(int &rcode,
+                                       isc::data::ConstElementPtr msg);
 
 ///
 /// \brief Creates a standard config/command command message with no
@@ -71,7 +74,7 @@
 /// 
 /// \param command The command string
 /// \return The created message
-ConstElementPtr createCommand(const std::string& command);
+isc::data::ConstElementPtr createCommand(const std::string& command);
 
 ///
 /// \brief Creates a standard config/command command message with the
@@ -81,7 +84,8 @@
 /// \param arg The optional argument for the command. This can be of 
 ///        any Element type, but it should conform to the .spec file.
 /// \return The created message
-ConstElementPtr createCommand(const std::string& command, ConstElementPtr arg);
+isc::data::ConstElementPtr createCommand(const std::string& command,
+                                         isc::data::ConstElementPtr arg);
 
 ///
 /// \brief Parses the given command into a string containing the actual
@@ -92,7 +96,8 @@
 /// \param command The command message containing the command (as made
 ///        by createCommand()
 /// \return The command string
-std::string parseCommand(ConstElementPtr& arg, ConstElementPtr command);
+std::string parseCommand(isc::data::ConstElementPtr& arg,
+                         isc::data::ConstElementPtr command);
 
 
 ///
@@ -225,8 +230,9 @@
      * \param identifier The identifier of the config value
      * \return The configuration setting at the given identifier
      */
-    ConstElementPtr getRemoteConfigValue(const std::string& module_name,
-                                         const std::string& identifier) const;
+    isc::data::ConstElementPtr getRemoteConfigValue(
+        const std::string& module_name,
+        const std::string& identifier) const;
     
 private:
     ModuleSpec readModuleSpecification(const std::string& filename);
@@ -235,7 +241,8 @@
     std::string module_name_;
     isc::cc::AbstractSession& session_;
     ModuleSpec module_specification_;
-    ConstElementPtr handleConfigUpdate(ConstElementPtr new_config);
+    isc::data::ConstElementPtr handleConfigUpdate(
+        isc::data::ConstElementPtr new_config);
 
     isc::data::ConstElementPtr(*config_handler_)(
         isc::data::ConstElementPtr new_config);
@@ -245,7 +252,7 @@
 
     std::map<std::string, ConfigData> remote_module_configs_;
     void updateRemoteConfig(const std::string& module_name,
-                            ConstElementPtr new_config);
+                            isc::data::ConstElementPtr new_config);
 };
 
 }

Modified: branches/trac373/src/lib/config/config_data.h
==============================================================================
--- branches/trac373/src/lib/config/config_data.h (original)
+++ branches/trac373/src/lib/config/config_data.h Sun Oct 17 05:32:48 2010
@@ -39,12 +39,14 @@
 public:
     /// Constructs a ConfigData option with no specification and an
     /// empty configuration.
-    ConfigData() { _config = Element::createMap(); };
+    ConfigData() { _config = isc::data::Element::createMap(); };
 
     /// Constructs a ConfigData option with the given specification
     /// and an empty configuration.
     /// \param module_spec A ModuleSpec for the relevant module
-    ConfigData(const ModuleSpec& module_spec) : _module_spec(module_spec) { _config = Element::createMap(); }
+    ConfigData(const ModuleSpec& module_spec) : _module_spec(module_spec) {
+        _config = isc::data::Element::createMap();
+    }
 
     virtual ~ConfigData() {};
 
@@ -55,7 +57,7 @@
     /// Raises a DataNotFoundError if the identifier is bad.
     /// \param identifier The identifier pointing to the configuration
     ///        value that is to be returned
-    ConstElementPtr getValue(const std::string& identifier) const;
+    isc::data::ConstElementPtr getValue(const std::string& identifier) const;
 
     /// Returns the value currently set for the given identifier
     /// If no value is set, the default value (as specified by the
@@ -67,8 +69,8 @@
     ///                   false otherwise
     /// \param identifier The identifier pointing to the configuration
     ///        value that is to be returned
-    ConstElementPtr getValue(bool& is_default,
-                             const std::string& identifier) const;
+    isc::data::ConstElementPtr getValue(bool& is_default,
+                                        const std::string& identifier) const;
 
     /// Returns the ModuleSpec associated with this ConfigData object
     const ModuleSpec& getModuleSpec() const { return (_module_spec); }
@@ -80,12 +82,12 @@
     /// \param config An ElementPtr pointing to a MapElement containing
     ///        *all* non-default configuration values. Existing values
     ///        will be removed.
-    void setLocalConfig(ElementPtr config) { _config = config; }
+    void setLocalConfig(isc::data::ElementPtr config) { _config = config; }
 
     /// Returns the local (i.e. non-default) configuration.
     /// \returns An ElementPtr pointing to a MapElement containing all
     ///          non-default configuration options.
-    ElementPtr getLocalConfig() { return (_config); }
+    isc::data::ElementPtr getLocalConfig() { return (_config); }
 
     /// Returns a list of all possible configuration options as specified
     ///         by the ModuleSpec.
@@ -97,18 +99,18 @@
     ///         StringElements that specify the identifiers at the given
     ///         location (or all possible identifiers if identifier==""
     ///         and recurse==false)
-    ConstElementPtr getItemList(const std::string& identifier = "",
-                                bool recurse = false) const;
+    isc::data::ConstElementPtr getItemList(const std::string& identifier = "",
+                                           bool recurse = false) const;
 
     /// Returns all current configuration settings (both non-default and default).
     /// \return An ElementPtr pointing to a MapElement containing
     ///         string->value elements, where the string is the
     ///         full identifier of the configuration option and the
     ///         value is an ElementPtr with the value.
-    ConstElementPtr getFullConfig() const;
+    isc::data::ConstElementPtr getFullConfig() const;
 
 private:
-    ElementPtr _config;
+    isc::data::ElementPtr _config;
     ModuleSpec _module_spec;
 };
 

Modified: branches/trac373/src/lib/config/module_spec.cc
==============================================================================
--- branches/trac373/src/lib/config/module_spec.cc (original)
+++ branches/trac373/src/lib/config/module_spec.cc Sun Oct 17 05:32:48 2010
@@ -24,6 +24,7 @@
 
 // todo: add more context to thrown ModuleSpecErrors?
 
+using namespace isc::data;
 using namespace isc::config;
 
 namespace {

Modified: branches/trac373/src/lib/config/module_spec.h
==============================================================================
--- branches/trac373/src/lib/config/module_spec.h (original)
+++ branches/trac373/src/lib/config/module_spec.h Sun Oct 17 05:32:48 2010
@@ -19,8 +19,6 @@
 #include <cc/data.h>
 
 #include <sstream>
-
-using namespace isc::data;
 
 namespace isc { namespace config {
 
@@ -55,24 +53,27 @@
         /// Create a \c ModuleSpec instance with the given data as
         /// the specification
         /// \param e The Element containing the data specification
-        explicit ModuleSpec(ConstElementPtr e, const bool check = true)
+        explicit ModuleSpec(isc::data::ConstElementPtr e,
+                            const bool check = true)
             throw(ModuleSpecError);
 
         /// Returns the commands part of the specification as an
         /// ElementPtr, returns an empty ElementPtr if there is none
         /// \return ElementPtr Shared pointer to the commands
         ///                    part of the specification
-        ConstElementPtr getCommandsSpec() const;
+        isc::data::ConstElementPtr getCommandsSpec() const;
 
         /// Returns the configuration part of the specification as an
         /// ElementPtr
         /// \return ElementPtr Shared pointer to the configuration
         ///                    part of the specification
-        ConstElementPtr getConfigSpec() const;
+        isc::data::ConstElementPtr getConfigSpec() const;
 
         /// Returns the full module specification as an ElementPtr
         /// \return ElementPtr Shared pointer to the specification
-        ConstElementPtr getFullSpec() const { return module_specification; }
+        isc::data::ConstElementPtr getFullSpec() const {
+            return module_specification;
+        }
 
         /// Returns the module name as specified by the specification
         const std::string getModuleName() const;
@@ -87,22 +88,28 @@
         /// \param data The base \c Element of the data to check
         /// \return true if the data conforms to the specification,
         /// false otherwise.
-        bool validate_config(ConstElementPtr data,
+        bool validate_config(isc::data::ConstElementPtr data,
                              const bool full = false) const;
 
         /// errors must be of type ListElement
-        bool validate_config(ConstElementPtr data, const bool full,
-                             ElementPtr errors) const;
+        bool validate_config(isc::data::ConstElementPtr data, const bool full,
+                             isc::data::ElementPtr errors) const;
 
     private:
-        bool validate_item(ConstElementPtr spec, ConstElementPtr data,
-                           const bool full, ElementPtr errors) const;
-        bool validate_spec(ConstElementPtr spec, ConstElementPtr data,
-                           const bool full, ElementPtr errors) const;
-        bool validate_spec_list(ConstElementPtr spec, ConstElementPtr data,
-                                const bool full, ElementPtr errors) const;
+        bool validate_item(isc::data::ConstElementPtr spec,
+                           isc::data::ConstElementPtr data,
+                           const bool full,
+                           isc::data::ElementPtr errors) const;
+        bool validate_spec(isc::data::ConstElementPtr spec,
+                           isc::data::ConstElementPtr data,
+                           const bool full,
+                           isc::data::ElementPtr errors) const;
+        bool validate_spec_list(isc::data::ConstElementPtr spec,
+                                isc::data::ConstElementPtr data,
+                                const bool full,
+                                isc::data::ElementPtr errors) const;
 
-        ConstElementPtr module_specification;
+        isc::data::ConstElementPtr module_specification;
     };
 
     /// Creates a \c ModuleSpec instance from the contents
@@ -115,7 +122,7 @@
     /// is checked to be of the correct form
     ModuleSpec
     moduleSpecFromFile(const std::string& file_name, const bool check = true)
-                       throw(JSONError, ModuleSpecError);
+        throw(isc::data::JSONError, ModuleSpecError);
 
     /// Creates a \c ModuleSpec instance from the given input
     /// stream that contains the contents of a .spec file.
@@ -127,7 +134,7 @@
     /// to be of the correct form
     ModuleSpec
     moduleSpecFromFile(std::ifstream& in, const bool check = true)
-                       throw(JSONError, ModuleSpecError);
+                       throw(isc::data::JSONError, ModuleSpecError);
 } }
 
 #endif // _DATA_DEF_H




More information about the bind10-changes mailing list