Browse Source

[1179] some moving around of code for consistency

Jelte Jansen 13 years ago
parent
commit
259955ba65

+ 9 - 16
src/lib/python/isc/datasrc/client_python.cc

@@ -47,23 +47,14 @@ using namespace isc::util::python;
 using namespace isc::datasrc;
 using namespace isc::datasrc::python;
 
-//
-// Definition of the classes
-//
-
-// For each class, we need a struct, a helper functions (init, destroy,
-// and static wrappers around the methods we export), a list of methods,
-// and a type description
-
-//
-// DataSourceClient
-//
-
-// Trivial constructor.
-s_DataSourceClient::s_DataSourceClient() : cppobj(NULL) {
-}
-
 namespace {
+// The s_* Class simply covers one instantiation of the object
+class s_DataSourceClient : public PyObject {
+public:
+    s_DataSourceClient() : cppobj(NULL) {};
+    DataSourceClient* cppobj;
+};
+
 // Shortcut type which would be convenient for adding class variables safely.
 typedef CPPPyObjectContainer<s_DataSourceClient, DataSourceClient>
     DataSourceClientContainer;
@@ -269,6 +260,7 @@ PyTypeObject datasourceclient_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 // Module Initialization, all statics are initialized here
 bool
 initModulePart_DataSourceClient(PyObject* mod) {
@@ -295,6 +287,7 @@ initModulePart_DataSourceClient(PyObject* mod) {
 
     return (true);
 }
+} // namespace internal
 
 } // namespace python
 } // namespace datasrc

+ 0 - 9
src/lib/python/isc/datasrc/client_python.h

@@ -23,17 +23,8 @@ class DataSourceClient;
 
 namespace python {
 
-// The s_* Class simply covers one instantiation of the object
-class s_DataSourceClient : public PyObject {
-public:
-    s_DataSourceClient();
-    DataSourceClient* cppobj;
-};
-
 extern PyTypeObject datasourceclient_type;
 
-bool initModulePart_DataSourceClient(PyObject* mod);
-
 } // namespace python
 } // namespace datasrc
 } // namespace isc

+ 10 - 0
src/lib/python/isc/datasrc/datasrc.cc

@@ -53,6 +53,14 @@ getDataSourceException(const char* ex_name) {
     }
     return (ex_obj);
 }
+
+namespace internal {
+bool initModulePart_DataSourceClient(PyObject* mod);
+bool initModulePart_ZoneFinder(PyObject* mod);
+bool initModulePart_ZoneIterator(PyObject* mod);
+bool initModulePart_ZoneUpdater(PyObject* mod);
+} // end namespace internal
+
 } // end namespace python
 } // end namespace datasrc
 } // end namespace isc
@@ -78,6 +86,8 @@ PyModuleDef iscDataSrc = {
 
 } // end anonymous namespace
 
+using namespace isc::datasrc::python::internal;
+
 PyMODINIT_FUNC
 PyInit_datasrc(void) {
     PyObject* mod = PyModule_Create(&iscDataSrc);

+ 9 - 16
src/lib/python/isc/datasrc/finder_python.cc

@@ -47,23 +47,14 @@ using namespace isc::util::python;
 using namespace isc::datasrc;
 using namespace isc::datasrc::python;
 
-//
-// Definition of the classes
-//
-
-// For each class, we need a struct, a helper functions (init, destroy,
-// and static wrappers around the methods we export), a list of methods,
-// and a type description
-
-//
-// Zone Finder
-//
-
-// Trivial constructor.
-s_ZoneFinder::s_ZoneFinder() : cppobj(ZoneFinderPtr()) {
-}
-
 namespace {
+// The s_* Class simply covers one instantiation of the object
+class s_ZoneFinder : public PyObject {
+public:
+    s_ZoneFinder() : cppobj(ZoneFinderPtr()) {};
+    ZoneFinderPtr cppobj;
+};
+
 // Shortcut type which would be convenient for adding class variables safely.
 typedef CPPPyObjectContainer<s_ZoneFinder, ZoneFinder> ZoneFinderContainer;
 
@@ -221,6 +212,7 @@ PyTypeObject zonefinder_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 // Module Initialization, all statics are initialized here
 bool
 initModulePart_ZoneFinder(PyObject* mod) {
@@ -259,6 +251,7 @@ initModulePart_ZoneFinder(PyObject* mod) {
 
     return (true);
 }
+} // namespace internal
 
 PyObject*
 createZoneFinderObject(isc::datasrc::ZoneFinderPtr source) {

+ 0 - 10
src/lib/python/isc/datasrc/finder_python.h

@@ -22,20 +22,10 @@ namespace datasrc {
 
 namespace python {
 
-// The s_* Class simply covers one instantiation of the object
-class s_ZoneFinder : public PyObject {
-public:
-    s_ZoneFinder();
-    ZoneFinderPtr cppobj;
-};
-
 extern PyTypeObject zonefinder_type;
 
-bool initModulePart_ZoneFinder(PyObject* mod);
-
 PyObject* createZoneFinderObject(isc::datasrc::ZoneFinderPtr source);
 
-
 } // namespace python
 } // namespace datasrc
 } // namespace isc

+ 9 - 16
src/lib/python/isc/datasrc/iterator_python.cc

@@ -43,23 +43,14 @@ using namespace isc::util::python;
 using namespace isc::datasrc;
 using namespace isc::datasrc::python;
 
-//
-// Definition of the classes
-//
-
-// For each class, we need a struct, a helper functions (init, destroy,
-// and static wrappers around the methods we export), a list of methods,
-// and a type description
-
-//
-// Zone Iterator
-//
-
-// Trivial constructor.
-s_ZoneIterator::s_ZoneIterator() : cppobj(ZoneIteratorPtr()) {
-}
-
 namespace {
+// The s_* Class simply covers one instantiation of the object
+class s_ZoneIterator : public PyObject {
+public:
+    s_ZoneIterator() : cppobj(ZoneIteratorPtr()) {};
+    ZoneIteratorPtr cppobj;
+};
+
 // Shortcut type which would be convenient for adding class variables safely.
 typedef CPPPyObjectContainer<s_ZoneIterator, ZoneIterator> ZoneIteratorContainer;
 
@@ -182,6 +173,7 @@ PyTypeObject zoneiterator_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 // Module Initialization, all statics are initialized here
 bool
 initModulePart_ZoneIterator(PyObject* mod) {
@@ -199,6 +191,7 @@ initModulePart_ZoneIterator(PyObject* mod) {
 
     return (true);
 }
+} // namespace internal
 
 PyObject*
 createZoneIteratorObject(isc::datasrc::ZoneIteratorPtr source) {

+ 0 - 9
src/lib/python/isc/datasrc/iterator_python.h

@@ -23,17 +23,8 @@ class DataSourceClient;
 
 namespace python {
 
-// The s_* Class simply covers one instantiation of the object
-class s_ZoneIterator : public PyObject {
-public:
-    s_ZoneIterator();
-    ZoneIteratorPtr cppobj;
-};
-
 extern PyTypeObject zoneiterator_type;
 
-bool initModulePart_ZoneIterator(PyObject* mod);
-
 PyObject* createZoneIteratorObject(isc::datasrc::ZoneIteratorPtr source);
 
 

+ 9 - 16
src/lib/python/isc/datasrc/updater_python.cc

@@ -47,23 +47,14 @@ using namespace isc::util::python;
 using namespace isc::datasrc;
 using namespace isc::datasrc::python;
 
-//
-// Definition of the classes
-//
-
-// For each class, we need a struct, a helper functions (init, destroy,
-// and static wrappers around the methods we export), a list of methods,
-// and a type description
-
-//
-// Zone Updater
-//
-
-// Trivial constructor.
-s_ZoneUpdater::s_ZoneUpdater() : cppobj(ZoneUpdaterPtr()) {
-}
-
 namespace {
+// The s_* Class simply covers one instantiation of the object
+class s_ZoneUpdater : public PyObject {
+public:
+    s_ZoneUpdater() : cppobj(ZoneUpdaterPtr()) {};
+    ZoneUpdaterPtr cppobj;
+};
+
 // Shortcut type which would be convenient for adding class variables safely.
 typedef CPPPyObjectContainer<s_ZoneUpdater, ZoneUpdater> ZoneUpdaterContainer;
 
@@ -288,6 +279,7 @@ PyTypeObject zoneupdater_type = {
     0                                   // tp_version_tag
 };
 
+namespace internal {
 // Module Initialization, all statics are initialized here
 bool
 initModulePart_ZoneUpdater(PyObject* mod) {
@@ -305,6 +297,7 @@ initModulePart_ZoneUpdater(PyObject* mod) {
 
     return (true);
 }
+} // namespace internal
 
 PyObject*
 createZoneUpdaterObject(isc::datasrc::ZoneUpdaterPtr source) {

+ 0 - 8
src/lib/python/isc/datasrc/updater_python.h

@@ -23,17 +23,9 @@ class DataSourceClient;
 
 namespace python {
 
-// The s_* Class simply covers one instantiation of the object
-class s_ZoneUpdater : public PyObject {
-public:
-    s_ZoneUpdater();
-    ZoneUpdaterPtr cppobj;
-};
 
 extern PyTypeObject zoneupdater_type;
 
-bool initModulePart_ZoneUpdater(PyObject* mod);
-
 PyObject* createZoneUpdaterObject(isc::datasrc::ZoneUpdaterPtr source);