From 6c3647858be91b75c03498563071b91fd612b082 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Fri, 5 Sep 2008 16:07:57 +0000 Subject: QPID-1274 - Moved management-gen data files into the qmf subdirectory to fix an install problem git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@692475 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/managementgen/Makefile.am | 20 ++- qpid/cpp/managementgen/management-types.xml | 56 ------- qpid/cpp/managementgen/qmf-gen | 6 +- qpid/cpp/managementgen/qmf/generate.py | 4 +- qpid/cpp/managementgen/qmf/management-types.xml | 56 +++++++ qpid/cpp/managementgen/qmf/templates/Args.h | 40 +++++ qpid/cpp/managementgen/qmf/templates/Class.cpp | 180 +++++++++++++++++++++++ qpid/cpp/managementgen/qmf/templates/Class.h | 106 +++++++++++++ qpid/cpp/managementgen/qmf/templates/Makefile.mk | 37 +++++ qpid/cpp/managementgen/qmf/templates/Package.cpp | 32 ++++ qpid/cpp/managementgen/qmf/templates/Package.h | 41 ++++++ qpid/cpp/managementgen/templates/Args.h | 40 ----- qpid/cpp/managementgen/templates/Class.cpp | 180 ----------------------- qpid/cpp/managementgen/templates/Class.h | 106 ------------- qpid/cpp/managementgen/templates/Makefile.mk | 37 ----- qpid/cpp/managementgen/templates/Package.cpp | 32 ---- qpid/cpp/managementgen/templates/Package.h | 41 ------ 17 files changed, 506 insertions(+), 508 deletions(-) delete mode 100644 qpid/cpp/managementgen/management-types.xml create mode 100644 qpid/cpp/managementgen/qmf/management-types.xml create mode 100644 qpid/cpp/managementgen/qmf/templates/Args.h create mode 100644 qpid/cpp/managementgen/qmf/templates/Class.cpp create mode 100644 qpid/cpp/managementgen/qmf/templates/Class.h create mode 100644 qpid/cpp/managementgen/qmf/templates/Makefile.mk create mode 100644 qpid/cpp/managementgen/qmf/templates/Package.cpp create mode 100644 qpid/cpp/managementgen/qmf/templates/Package.h delete mode 100644 qpid/cpp/managementgen/templates/Args.h delete mode 100644 qpid/cpp/managementgen/templates/Class.cpp delete mode 100644 qpid/cpp/managementgen/templates/Class.h delete mode 100644 qpid/cpp/managementgen/templates/Makefile.mk delete mode 100644 qpid/cpp/managementgen/templates/Package.cpp delete mode 100644 qpid/cpp/managementgen/templates/Package.h (limited to 'qpid/cpp') diff --git a/qpid/cpp/managementgen/Makefile.am b/qpid/cpp/managementgen/Makefile.am index 7a415b4be6..c8c1e64492 100644 --- a/qpid/cpp/managementgen/Makefile.am +++ b/qpid/cpp/managementgen/Makefile.am @@ -1,18 +1,16 @@ -qmfdatadir = $(datadir)/qmf qmfpythondir = $(pythondir) dist_bin_SCRIPTS = \ qmf-gen -nobase_qmfdata_DATA = \ - templates/Args.h \ - templates/Class.cpp \ - templates/Class.h \ - templates/Makefile.mk \ - templates/Package.cpp \ - templates/Package.h \ - management-types.xml nobase_qmfpython_DATA = \ qmf/__init__.py \ qmf/generate.py \ - qmf/schema.py + qmf/schema.py \ + qmf/templates/Args.h \ + qmf/templates/Class.cpp \ + qmf/templates/Class.h \ + qmf/templates/Makefile.mk \ + qmf/templates/Package.cpp \ + qmf/templates/Package.h \ + qmf/management-types.xml -EXTRA_DIST = $(nobase_qmfdata_DATA) $(nobase_qmfpython_DATA) +EXTRA_DIST = $(nobase_qmfpython_DATA) diff --git a/qpid/cpp/managementgen/management-types.xml b/qpid/cpp/managementgen/management-types.xml deleted file mode 100644 index 31337b23bc..0000000000 --- a/qpid/cpp/managementgen/management-types.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/managementgen/qmf-gen b/qpid/cpp/managementgen/qmf-gen index a29a4074fd..840733bf7b 100755 --- a/qpid/cpp/managementgen/qmf-gen +++ b/qpid/cpp/managementgen/qmf-gen @@ -24,16 +24,16 @@ from qmf.schema import PackageSchema, SchemaClass from qmf.generate import Generator from optparse import OptionParser -dataPath = os.path.dirname(sys.argv[0]) +dataPath = os.path.dirname(sys.argv[0]) + "/qmf/" # Set command line options usage = "usage: %prog [options] schema-document out-directory" parser = OptionParser (usage=usage) parser.add_option ("-m", "--makefile", dest="makefile", metavar="FILE", help="Makefile fragment") -parser.add_option ("-t", "--typefile", dest="typefile", metavar="FILE", default=dataPath + "/management-types.xml", +parser.add_option ("-t", "--typefile", dest="typefile", metavar="FILE", default=dataPath + "management-types.xml", help="Type descriptor file") -parser.add_option ("-d", "--templatedir", dest="templatedir", metavar="DIR", default=dataPath + "/templates", +parser.add_option ("-d", "--templatedir", dest="templatedir", metavar="DIR", default=dataPath + "templates", help="Template directory") (opts, args) = parser.parse_args () diff --git a/qpid/cpp/managementgen/qmf/generate.py b/qpid/cpp/managementgen/qmf/generate.py index c1edf0b8e2..70735b208a 100755 --- a/qpid/cpp/managementgen/qmf/generate.py +++ b/qpid/cpp/managementgen/qmf/generate.py @@ -110,7 +110,7 @@ class Makefile: stream.write (mdir + "/qmf-gen \\\n") stream.write (" " + mdir + "/qmf/generate.py \\\n") stream.write (" " + mdir + "/qmf/schema.py \\\n") - stream.write (" " + mdir + "/management-types.xml \\\n") + stream.write (" " + mdir + "/qmf/management-types.xml \\\n") stream.write (" " + sdir + "/management-schema.xml \\\n") first = True for template in self.templateFiles: @@ -119,7 +119,7 @@ class Makefile: stream.write (" ") else: stream.write (" \\\n ") - stream.write (mdir + "/templates/" + template) + stream.write (mdir + "/qmf/templates/" + template) def genGenCppFiles (self, stream, variables): first = True diff --git a/qpid/cpp/managementgen/qmf/management-types.xml b/qpid/cpp/managementgen/qmf/management-types.xml new file mode 100644 index 0000000000..31337b23bc --- /dev/null +++ b/qpid/cpp/managementgen/qmf/management-types.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/cpp/managementgen/qmf/templates/Args.h b/qpid/cpp/managementgen/qmf/templates/Args.h new file mode 100644 index 0000000000..576d891a3f --- /dev/null +++ b/qpid/cpp/managementgen/qmf/templates/Args.h @@ -0,0 +1,40 @@ +/*MGEN:commentPrefix=//*/ +#ifndef _ARGS_/*MGEN:Method.NameUpper*/_ +#define _ARGS_/*MGEN:Method.NameUpper*/_ + +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +/*MGEN:Root.Disclaimer*/ + +#include "qpid/management/Args.h" +#include + +namespace qpid { +namespace management { + +class Args/*MGEN:Method.NameCamel*/ : public Args +{ + public: +/*MGEN:Method.Arguments*/ +}; + +}} + +#endif /*!_ARGS_/*MGEN:Method.NameUpper*/_*/ diff --git a/qpid/cpp/managementgen/qmf/templates/Class.cpp b/qpid/cpp/managementgen/qmf/templates/Class.cpp new file mode 100644 index 0000000000..2a0e55b34d --- /dev/null +++ b/qpid/cpp/managementgen/qmf/templates/Class.cpp @@ -0,0 +1,180 @@ +/*MGEN:commentPrefix=//*/ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +/*MGEN:Root.Disclaimer*/ + +#include "qpid/log/Statement.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/management/Manageable.h" +#include "qpid/agent/ManagementAgent.h" +#include "/*MGEN:Class.NameCap*/.h" +/*MGEN:Class.MethodArgIncludes*/ + +using namespace qpid::management; +using namespace qpid::sys; +using namespace qpid::framing; +using std::string; + +string /*MGEN:Class.NameCap*/::packageName = string ("/*MGEN:Class.NamePackageLower*/"); +string /*MGEN:Class.NameCap*/::className = string ("/*MGEN:Class.NameLower*/"); +uint8_t /*MGEN:Class.NameCap*/::md5Sum[16] = + {/*MGEN:Class.SchemaMD5*/}; + +/*MGEN:Class.NameCap*/::/*MGEN:Class.NameCap*/ (ManagementAgent* _agent, Manageable* _core/*MGEN:Class.ParentArg*//*MGEN:Class.ConstructorArgs*/) : + ManagementObject(_agent, _core)/*MGEN:Class.ConstructorInits*/ +{ + /*MGEN:Class.ParentRefAssignment*/ +/*MGEN:Class.InitializeElements*/ +/*MGEN:IF(Class.ExistOptionals)*/ + // Optional properties start out not-present + for (uint8_t idx = 0; idx < /*MGEN:Class.PresenceMaskBytes*/; idx++) + presenceMask[idx] = 0; +/*MGEN:ENDIF*/ +/*MGEN:IF(Class.ExistPerThreadStats)*/ + maxThreads = agent->getMaxThreads(); + perThreadStatsArray = new struct PerThreadStats*[maxThreads]; + for (int idx = 0; idx < maxThreads; idx++) + perThreadStatsArray[idx] = 0; +/*MGEN:ENDIF*/ +} + +/*MGEN:Class.NameCap*/::~/*MGEN:Class.NameCap*/ () +{ +/*MGEN:IF(Class.ExistPerThreadStats)*/ + for (int idx = 0; idx < maxThreads; idx++) + if (perThreadStatsArray[idx] != 0) + delete perThreadStatsArray[idx]; + delete[] perThreadStatsArray; +/*MGEN:ENDIF*/ +} + +namespace { + const string NAME("name"); + const string TYPE("type"); + const string ACCESS("access"); + const string INDEX("index"); + const string OPTIONAL("optional"); + const string UNIT("unit"); + const string MIN("min"); + const string MAX("max"); + const string MAXLEN("maxlen"); + const string DESC("desc"); + const string ARGCOUNT("argCount"); + const string ARGS("args"); + const string DIR("dir"); + const string DEFAULT("default"); +} + +void /*MGEN:Class.NameCap*/::registerClass(ManagementAgent* agent) +{ + agent->RegisterClass(packageName, className, md5Sum, writeSchema); +} + +void /*MGEN:Class.NameCap*/::writeSchema (Buffer& buf) +{ + FieldTable ft; + + // Schema class header: + buf.putShortString (packageName); // Package Name + buf.putShortString (className); // Class Name + buf.putBin128 (md5Sum); // Schema Hash + buf.putShort (/*MGEN:Class.ConfigCount*/); // Config Element Count + buf.putShort (/*MGEN:Class.InstCount*/); // Inst Element Count + buf.putShort (/*MGEN:Class.MethodCount*/); // Method Count + buf.putShort (/*MGEN:Class.EventCount*/); // Event Count + + // Properties +/*MGEN:Class.PropertySchema*/ + // Statistics +/*MGEN:Class.StatisticSchema*/ + // Methods +/*MGEN:Class.MethodSchema*/ + // Events +/*MGEN:Class.EventSchema*/ +} + +/*MGEN:IF(Class.ExistPerThreadStats)*/ +void /*MGEN:Class.NameCap*/::aggregatePerThreadStats(struct PerThreadStats* totals) +{ +/*MGEN:Class.InitializeTotalPerThreadStats*/ + for (int idx = 0; idx < maxThreads; idx++) { + struct PerThreadStats* threadStats = perThreadStatsArray[idx]; + if (threadStats != 0) { +/*MGEN:Class.AggregatePerThreadStats*/ + } + } +} +/*MGEN:ENDIF*/ + +void /*MGEN:Class.NameCap*/::writeProperties (Buffer& buf) +{ + sys::Mutex::ScopedLock mutex(accessLock); + configChanged = false; + + writeTimestamps (buf); +/*MGEN:IF(Class.ExistOptionals)*/ + for (uint8_t idx = 0; idx < /*MGEN:Class.PresenceMaskBytes*/; idx++) + buf.putOctet(presenceMask[idx]); +/*MGEN:ENDIF*/ +/*MGEN:Class.WriteProperties*/ +} + +void /*MGEN:Class.NameCap*/::writeStatistics (Buffer& buf, bool skipHeaders) +{ + sys::Mutex::ScopedLock mutex(accessLock); + instChanged = false; +/*MGEN:IF(Class.ExistPerThreadAssign)*/ + for (int idx = 0; idx < maxThreads; idx++) { + struct PerThreadStats* threadStats = perThreadStatsArray[idx]; + if (threadStats != 0) { +/*MGEN:Class.PerThreadAssign*/ + } + } +/*MGEN:ENDIF*/ +/*MGEN:IF(Class.ExistPerThreadStats)*/ + struct PerThreadStats totals; + aggregatePerThreadStats(&totals); +/*MGEN:ENDIF*/ +/*MGEN:Class.Assign*/ + if (!skipHeaders) + writeTimestamps (buf); +/*MGEN:Class.WriteStatistics*/ + + // Maintenance of hi-lo statistics +/*MGEN:Class.HiLoStatResets*/ +/*MGEN:IF(Class.ExistPerThreadResets)*/ + for (int idx = 0; idx < maxThreads; idx++) { + struct PerThreadStats* threadStats = perThreadStatsArray[idx]; + if (threadStats != 0) { +/*MGEN:Class.PerThreadHiLoStatResets*/ + } + } +/*MGEN:ENDIF*/ +} + +void /*MGEN:Class.NameCap*/::doMethod (/*MGEN:Class.DoMethodArgs*/) +{ + Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD; +/*MGEN:Class.MethodHandlers*/ + outBuf.putLong (status); + outBuf.putShortString (Manageable::StatusText (status)); +} + +/*MGEN:Class.EventMethodBodies*/ diff --git a/qpid/cpp/managementgen/qmf/templates/Class.h b/qpid/cpp/managementgen/qmf/templates/Class.h new file mode 100644 index 0000000000..40ad20eb85 --- /dev/null +++ b/qpid/cpp/managementgen/qmf/templates/Class.h @@ -0,0 +1,106 @@ +/*MGEN:commentPrefix=//*/ +#ifndef _MANAGEMENT_/*MGEN:Class.NameUpper*/_ +#define _MANAGEMENT_/*MGEN:Class.NameUpper*/_ + +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +/*MGEN:Root.Disclaimer*/ + +#include "qpid/management/ManagementObject.h" +#include "qpid/framing/FieldTable.h" +#include "qpid/framing/Uuid.h" + +namespace qpid { +namespace management { + +class /*MGEN:Class.NameCap*/ : public ManagementObject +{ + private: + + static std::string packageName; + static std::string className; + static uint8_t md5Sum[16]; +/*MGEN:IF(Class.ExistOptionals)*/ + uint8_t presenceMask[/*MGEN:Class.PresenceMaskBytes*/]; +/*MGEN:Class.PresenceMaskConstants*/ +/*MGEN:ENDIF*/ + + // Properties +/*MGEN:Class.ConfigDeclarations*/ + // Statistics +/*MGEN:Class.InstDeclarations*/ +/*MGEN:IF(Class.ExistPerThreadStats)*/ + // Per-Thread Statistics + struct PerThreadStats { +/*MGEN:Class.PerThreadDeclarations*/ + }; + + struct PerThreadStats** perThreadStatsArray; + + inline struct PerThreadStats* getThreadStats() { + int index = getThreadIndex(); + struct PerThreadStats* threadStats = perThreadStatsArray[index]; + if (threadStats == 0) { + threadStats = new(PerThreadStats); + perThreadStatsArray[index] = threadStats; +/*MGEN:Class.InitializePerThreadElements*/ + } + return threadStats; + } + + void aggregatePerThreadStats(struct PerThreadStats*); +/*MGEN:ENDIF*/ + // Private Methods + static void writeSchema (qpid::framing::Buffer& buf); + void writeProperties (qpid::framing::Buffer& buf); + void writeStatistics (qpid::framing::Buffer& buf, + bool skipHeaders = false); + void doMethod (std::string methodName, + qpid::framing::Buffer& inBuf, + qpid::framing::Buffer& outBuf); + writeSchemaCall_t getWriteSchemaCall(void) { return writeSchema; } +/*MGEN:IF(Class.NoStatistics)*/ + // Stub for getInstChanged. There are no statistics in this class. + bool getInstChanged (void) { return false; } +/*MGEN:ENDIF*/ + public: + + /*MGEN:Class.NameCap*/ (ManagementAgent* agent, + Manageable* coreObject/*MGEN:Class.ParentArg*//*MGEN:Class.ConstructorArgs*/); + ~/*MGEN:Class.NameCap*/ (void); + + /*MGEN:Class.SetGeneralReferenceDeclaration*/ + + static void registerClass (ManagementAgent* agent); + std::string& getPackageName (void) { return packageName; } + std::string& getClassName (void) { return className; } + uint8_t* getMd5Sum (void) { return md5Sum; } + + // Method IDs +/*MGEN:Class.MethodIdDeclarations*/ + // Accessor Methods +/*MGEN:Class.AccessorMethods*/ + // Event Methods +/*MGEN:Class.EventMethodDecls*/ +}; + +}} + +#endif /*!_MANAGEMENT_/*MGEN:Class.NameUpper*/_*/ diff --git a/qpid/cpp/managementgen/qmf/templates/Makefile.mk b/qpid/cpp/managementgen/qmf/templates/Makefile.mk new file mode 100644 index 0000000000..0e6454c13a --- /dev/null +++ b/qpid/cpp/managementgen/qmf/templates/Makefile.mk @@ -0,0 +1,37 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +/*MGEN:commentPrefix=#*/ +/*MGEN:mgenDir=$(mgen_dir)*/ +/*MGEN:specDir=$(top_srcdir)/../specs*/ +/*MGEN:Root.Disclaimer*/ + +mgen_generator=/*MGEN:Makefile.GenSources*/ + +mgen_broker_cpp=/*MGEN:Makefile.GenCppFiles*/ + +# Header file install rules. +qpid_managementdir = $(includedir)/qpid/management +dist_qpid_management_HEADERS = /*MGEN:Makefile.GenHFiles*/ + +if GENERATE +$(srcdir)/managementgen.mk: $(mgen_generator) + $(mgen_cmd) + +$(mgen_generator): +endif diff --git a/qpid/cpp/managementgen/qmf/templates/Package.cpp b/qpid/cpp/managementgen/qmf/templates/Package.cpp new file mode 100644 index 0000000000..15e7fc15ec --- /dev/null +++ b/qpid/cpp/managementgen/qmf/templates/Package.cpp @@ -0,0 +1,32 @@ +/*MGEN:commentPrefix=//*/ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +/*MGEN:Root.Disclaimer*/ + +#include "Package/*MGEN:Schema.PackageNameCap*/.h" +/*MGEN:Schema.ClassIncludes*/ + +using namespace qpid::management; + +Package/*MGEN:Schema.PackageNameCap*/::Package/*MGEN:Schema.PackageNameCap*/ (ManagementAgent* agent) +{ +/*MGEN:Schema.ClassRegisters*/ +} + diff --git a/qpid/cpp/managementgen/qmf/templates/Package.h b/qpid/cpp/managementgen/qmf/templates/Package.h new file mode 100644 index 0000000000..3f3ac35ffc --- /dev/null +++ b/qpid/cpp/managementgen/qmf/templates/Package.h @@ -0,0 +1,41 @@ +/*MGEN:commentPrefix=//*/ +#ifndef _MANAGEMENT_PACKAGE_/*MGEN:Schema.PackageNameUpper*/_ +#define _MANAGEMENT_PACKAGE_/*MGEN:Schema.PackageNameUpper*/_ + +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +/*MGEN:Root.Disclaimer*/ + +#include "qpid/agent/ManagementAgent.h" + +namespace qpid { +namespace management { + +class Package/*MGEN:Schema.PackageNameCap*/ +{ + public: + Package/*MGEN:Schema.PackageNameCap*/ (ManagementAgent* agent); + ~Package/*MGEN:Schema.PackageNameCap*/ () {} +}; + +}} + + +#endif /*!_MANAGEMENT_PACKAGE_/*MGEN:Schema.PackageNameUpper*/_*/ diff --git a/qpid/cpp/managementgen/templates/Args.h b/qpid/cpp/managementgen/templates/Args.h deleted file mode 100644 index 576d891a3f..0000000000 --- a/qpid/cpp/managementgen/templates/Args.h +++ /dev/null @@ -1,40 +0,0 @@ -/*MGEN:commentPrefix=//*/ -#ifndef _ARGS_/*MGEN:Method.NameUpper*/_ -#define _ARGS_/*MGEN:Method.NameUpper*/_ - -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -/*MGEN:Root.Disclaimer*/ - -#include "qpid/management/Args.h" -#include - -namespace qpid { -namespace management { - -class Args/*MGEN:Method.NameCamel*/ : public Args -{ - public: -/*MGEN:Method.Arguments*/ -}; - -}} - -#endif /*!_ARGS_/*MGEN:Method.NameUpper*/_*/ diff --git a/qpid/cpp/managementgen/templates/Class.cpp b/qpid/cpp/managementgen/templates/Class.cpp deleted file mode 100644 index 2a0e55b34d..0000000000 --- a/qpid/cpp/managementgen/templates/Class.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/*MGEN:commentPrefix=//*/ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -/*MGEN:Root.Disclaimer*/ - -#include "qpid/log/Statement.h" -#include "qpid/framing/FieldTable.h" -#include "qpid/management/Manageable.h" -#include "qpid/agent/ManagementAgent.h" -#include "/*MGEN:Class.NameCap*/.h" -/*MGEN:Class.MethodArgIncludes*/ - -using namespace qpid::management; -using namespace qpid::sys; -using namespace qpid::framing; -using std::string; - -string /*MGEN:Class.NameCap*/::packageName = string ("/*MGEN:Class.NamePackageLower*/"); -string /*MGEN:Class.NameCap*/::className = string ("/*MGEN:Class.NameLower*/"); -uint8_t /*MGEN:Class.NameCap*/::md5Sum[16] = - {/*MGEN:Class.SchemaMD5*/}; - -/*MGEN:Class.NameCap*/::/*MGEN:Class.NameCap*/ (ManagementAgent* _agent, Manageable* _core/*MGEN:Class.ParentArg*//*MGEN:Class.ConstructorArgs*/) : - ManagementObject(_agent, _core)/*MGEN:Class.ConstructorInits*/ -{ - /*MGEN:Class.ParentRefAssignment*/ -/*MGEN:Class.InitializeElements*/ -/*MGEN:IF(Class.ExistOptionals)*/ - // Optional properties start out not-present - for (uint8_t idx = 0; idx < /*MGEN:Class.PresenceMaskBytes*/; idx++) - presenceMask[idx] = 0; -/*MGEN:ENDIF*/ -/*MGEN:IF(Class.ExistPerThreadStats)*/ - maxThreads = agent->getMaxThreads(); - perThreadStatsArray = new struct PerThreadStats*[maxThreads]; - for (int idx = 0; idx < maxThreads; idx++) - perThreadStatsArray[idx] = 0; -/*MGEN:ENDIF*/ -} - -/*MGEN:Class.NameCap*/::~/*MGEN:Class.NameCap*/ () -{ -/*MGEN:IF(Class.ExistPerThreadStats)*/ - for (int idx = 0; idx < maxThreads; idx++) - if (perThreadStatsArray[idx] != 0) - delete perThreadStatsArray[idx]; - delete[] perThreadStatsArray; -/*MGEN:ENDIF*/ -} - -namespace { - const string NAME("name"); - const string TYPE("type"); - const string ACCESS("access"); - const string INDEX("index"); - const string OPTIONAL("optional"); - const string UNIT("unit"); - const string MIN("min"); - const string MAX("max"); - const string MAXLEN("maxlen"); - const string DESC("desc"); - const string ARGCOUNT("argCount"); - const string ARGS("args"); - const string DIR("dir"); - const string DEFAULT("default"); -} - -void /*MGEN:Class.NameCap*/::registerClass(ManagementAgent* agent) -{ - agent->RegisterClass(packageName, className, md5Sum, writeSchema); -} - -void /*MGEN:Class.NameCap*/::writeSchema (Buffer& buf) -{ - FieldTable ft; - - // Schema class header: - buf.putShortString (packageName); // Package Name - buf.putShortString (className); // Class Name - buf.putBin128 (md5Sum); // Schema Hash - buf.putShort (/*MGEN:Class.ConfigCount*/); // Config Element Count - buf.putShort (/*MGEN:Class.InstCount*/); // Inst Element Count - buf.putShort (/*MGEN:Class.MethodCount*/); // Method Count - buf.putShort (/*MGEN:Class.EventCount*/); // Event Count - - // Properties -/*MGEN:Class.PropertySchema*/ - // Statistics -/*MGEN:Class.StatisticSchema*/ - // Methods -/*MGEN:Class.MethodSchema*/ - // Events -/*MGEN:Class.EventSchema*/ -} - -/*MGEN:IF(Class.ExistPerThreadStats)*/ -void /*MGEN:Class.NameCap*/::aggregatePerThreadStats(struct PerThreadStats* totals) -{ -/*MGEN:Class.InitializeTotalPerThreadStats*/ - for (int idx = 0; idx < maxThreads; idx++) { - struct PerThreadStats* threadStats = perThreadStatsArray[idx]; - if (threadStats != 0) { -/*MGEN:Class.AggregatePerThreadStats*/ - } - } -} -/*MGEN:ENDIF*/ - -void /*MGEN:Class.NameCap*/::writeProperties (Buffer& buf) -{ - sys::Mutex::ScopedLock mutex(accessLock); - configChanged = false; - - writeTimestamps (buf); -/*MGEN:IF(Class.ExistOptionals)*/ - for (uint8_t idx = 0; idx < /*MGEN:Class.PresenceMaskBytes*/; idx++) - buf.putOctet(presenceMask[idx]); -/*MGEN:ENDIF*/ -/*MGEN:Class.WriteProperties*/ -} - -void /*MGEN:Class.NameCap*/::writeStatistics (Buffer& buf, bool skipHeaders) -{ - sys::Mutex::ScopedLock mutex(accessLock); - instChanged = false; -/*MGEN:IF(Class.ExistPerThreadAssign)*/ - for (int idx = 0; idx < maxThreads; idx++) { - struct PerThreadStats* threadStats = perThreadStatsArray[idx]; - if (threadStats != 0) { -/*MGEN:Class.PerThreadAssign*/ - } - } -/*MGEN:ENDIF*/ -/*MGEN:IF(Class.ExistPerThreadStats)*/ - struct PerThreadStats totals; - aggregatePerThreadStats(&totals); -/*MGEN:ENDIF*/ -/*MGEN:Class.Assign*/ - if (!skipHeaders) - writeTimestamps (buf); -/*MGEN:Class.WriteStatistics*/ - - // Maintenance of hi-lo statistics -/*MGEN:Class.HiLoStatResets*/ -/*MGEN:IF(Class.ExistPerThreadResets)*/ - for (int idx = 0; idx < maxThreads; idx++) { - struct PerThreadStats* threadStats = perThreadStatsArray[idx]; - if (threadStats != 0) { -/*MGEN:Class.PerThreadHiLoStatResets*/ - } - } -/*MGEN:ENDIF*/ -} - -void /*MGEN:Class.NameCap*/::doMethod (/*MGEN:Class.DoMethodArgs*/) -{ - Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD; -/*MGEN:Class.MethodHandlers*/ - outBuf.putLong (status); - outBuf.putShortString (Manageable::StatusText (status)); -} - -/*MGEN:Class.EventMethodBodies*/ diff --git a/qpid/cpp/managementgen/templates/Class.h b/qpid/cpp/managementgen/templates/Class.h deleted file mode 100644 index 40ad20eb85..0000000000 --- a/qpid/cpp/managementgen/templates/Class.h +++ /dev/null @@ -1,106 +0,0 @@ -/*MGEN:commentPrefix=//*/ -#ifndef _MANAGEMENT_/*MGEN:Class.NameUpper*/_ -#define _MANAGEMENT_/*MGEN:Class.NameUpper*/_ - -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -/*MGEN:Root.Disclaimer*/ - -#include "qpid/management/ManagementObject.h" -#include "qpid/framing/FieldTable.h" -#include "qpid/framing/Uuid.h" - -namespace qpid { -namespace management { - -class /*MGEN:Class.NameCap*/ : public ManagementObject -{ - private: - - static std::string packageName; - static std::string className; - static uint8_t md5Sum[16]; -/*MGEN:IF(Class.ExistOptionals)*/ - uint8_t presenceMask[/*MGEN:Class.PresenceMaskBytes*/]; -/*MGEN:Class.PresenceMaskConstants*/ -/*MGEN:ENDIF*/ - - // Properties -/*MGEN:Class.ConfigDeclarations*/ - // Statistics -/*MGEN:Class.InstDeclarations*/ -/*MGEN:IF(Class.ExistPerThreadStats)*/ - // Per-Thread Statistics - struct PerThreadStats { -/*MGEN:Class.PerThreadDeclarations*/ - }; - - struct PerThreadStats** perThreadStatsArray; - - inline struct PerThreadStats* getThreadStats() { - int index = getThreadIndex(); - struct PerThreadStats* threadStats = perThreadStatsArray[index]; - if (threadStats == 0) { - threadStats = new(PerThreadStats); - perThreadStatsArray[index] = threadStats; -/*MGEN:Class.InitializePerThreadElements*/ - } - return threadStats; - } - - void aggregatePerThreadStats(struct PerThreadStats*); -/*MGEN:ENDIF*/ - // Private Methods - static void writeSchema (qpid::framing::Buffer& buf); - void writeProperties (qpid::framing::Buffer& buf); - void writeStatistics (qpid::framing::Buffer& buf, - bool skipHeaders = false); - void doMethod (std::string methodName, - qpid::framing::Buffer& inBuf, - qpid::framing::Buffer& outBuf); - writeSchemaCall_t getWriteSchemaCall(void) { return writeSchema; } -/*MGEN:IF(Class.NoStatistics)*/ - // Stub for getInstChanged. There are no statistics in this class. - bool getInstChanged (void) { return false; } -/*MGEN:ENDIF*/ - public: - - /*MGEN:Class.NameCap*/ (ManagementAgent* agent, - Manageable* coreObject/*MGEN:Class.ParentArg*//*MGEN:Class.ConstructorArgs*/); - ~/*MGEN:Class.NameCap*/ (void); - - /*MGEN:Class.SetGeneralReferenceDeclaration*/ - - static void registerClass (ManagementAgent* agent); - std::string& getPackageName (void) { return packageName; } - std::string& getClassName (void) { return className; } - uint8_t* getMd5Sum (void) { return md5Sum; } - - // Method IDs -/*MGEN:Class.MethodIdDeclarations*/ - // Accessor Methods -/*MGEN:Class.AccessorMethods*/ - // Event Methods -/*MGEN:Class.EventMethodDecls*/ -}; - -}} - -#endif /*!_MANAGEMENT_/*MGEN:Class.NameUpper*/_*/ diff --git a/qpid/cpp/managementgen/templates/Makefile.mk b/qpid/cpp/managementgen/templates/Makefile.mk deleted file mode 100644 index 0e6454c13a..0000000000 --- a/qpid/cpp/managementgen/templates/Makefile.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http:#www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -/*MGEN:commentPrefix=#*/ -/*MGEN:mgenDir=$(mgen_dir)*/ -/*MGEN:specDir=$(top_srcdir)/../specs*/ -/*MGEN:Root.Disclaimer*/ - -mgen_generator=/*MGEN:Makefile.GenSources*/ - -mgen_broker_cpp=/*MGEN:Makefile.GenCppFiles*/ - -# Header file install rules. -qpid_managementdir = $(includedir)/qpid/management -dist_qpid_management_HEADERS = /*MGEN:Makefile.GenHFiles*/ - -if GENERATE -$(srcdir)/managementgen.mk: $(mgen_generator) - $(mgen_cmd) - -$(mgen_generator): -endif diff --git a/qpid/cpp/managementgen/templates/Package.cpp b/qpid/cpp/managementgen/templates/Package.cpp deleted file mode 100644 index 15e7fc15ec..0000000000 --- a/qpid/cpp/managementgen/templates/Package.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/*MGEN:commentPrefix=//*/ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -/*MGEN:Root.Disclaimer*/ - -#include "Package/*MGEN:Schema.PackageNameCap*/.h" -/*MGEN:Schema.ClassIncludes*/ - -using namespace qpid::management; - -Package/*MGEN:Schema.PackageNameCap*/::Package/*MGEN:Schema.PackageNameCap*/ (ManagementAgent* agent) -{ -/*MGEN:Schema.ClassRegisters*/ -} - diff --git a/qpid/cpp/managementgen/templates/Package.h b/qpid/cpp/managementgen/templates/Package.h deleted file mode 100644 index 3f3ac35ffc..0000000000 --- a/qpid/cpp/managementgen/templates/Package.h +++ /dev/null @@ -1,41 +0,0 @@ -/*MGEN:commentPrefix=//*/ -#ifndef _MANAGEMENT_PACKAGE_/*MGEN:Schema.PackageNameUpper*/_ -#define _MANAGEMENT_PACKAGE_/*MGEN:Schema.PackageNameUpper*/_ - -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -/*MGEN:Root.Disclaimer*/ - -#include "qpid/agent/ManagementAgent.h" - -namespace qpid { -namespace management { - -class Package/*MGEN:Schema.PackageNameCap*/ -{ - public: - Package/*MGEN:Schema.PackageNameCap*/ (ManagementAgent* agent); - ~Package/*MGEN:Schema.PackageNameCap*/ () {} -}; - -}} - - -#endif /*!_MANAGEMENT_PACKAGE_/*MGEN:Schema.PackageNameUpper*/_*/ -- cgit v1.2.1