activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r652104 [21/29] - in /activemq/activemq-cpp/trunk: ./ m4/ src/examples/ src/examples/consumers/ src/main/ src/main/decaf/ src/main/decaf/internal/ src/main/decaf/internal/net/ src/main/decaf/internal/nio/ src/main/decaf/internal/util/ src/m...
Date Tue, 29 Apr 2008 20:52:37 GMT
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,406 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_LOGGER_H_
+#define _DECAF_UTIL_LOGGING_LOGGER_H_
+
+#include <decaf/util/logging/LoggerCommon.h>
+#include <decaf/util/logging/LogRecord.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/util/Config.h>
+
+#include <list>
+#include <string>
+#include <stdarg.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    class Handler;
+    class Filter;
+
+    class DECAF_API Logger
+    {
+    private:
+
+        // The name of this Logger
+        std::string name;
+
+        // The Parent of this Logger
+        Logger* parent;
+
+        // list of Handlers owned by this logger
+        std::list<Handler*> handlers;
+
+        // Filter used by this Logger
+        Filter* filter;
+
+        // The Log Level of this Logger
+        Level level;
+
+        // Using Parent Handlers?
+        bool useParentHandlers;
+
+    public:
+
+        /**
+         * Creates a new instance of the Logger with the given name
+         * and assign it the given parent logger.
+         * <p>
+         * The logger will be initially configured with a null Level
+         * and with useParentHandlers true.
+         * @param name - A name for the logger. This should be a
+         * dot-separated name and should normally be based on the package
+         * name or class name of the subsystem, such as java.net or
+         * javax.swing. It may be null for anonymous Loggers.
+         * @param parent logger that is this one's parent
+         */
+        Logger( const std::string& name, Logger* parent );
+
+        virtual ~Logger();
+
+        /**
+         * Gets the name of this Logger
+         * @return logger name
+         */
+        virtual const std::string& getName(void) const {
+            return name;
+        }
+
+        /**
+         * Add a log Handler to receive logging messages.
+         * <p>
+         * By default, Loggers also send their output to their parent logger.
+         * Typically the root Logger is configured with a set of Handlers
+         * that essentially act as default handlers for all loggers.
+         *
+         * @param handler A Logging Handler
+         * #throws IllegalArgumentException
+         */
+        virtual void addHandler( Handler* handler )
+            throw ( lang::exceptions::IllegalArgumentException );
+
+        /**
+         * Removes the specified Handler and destroys it
+         * <p>
+         * Returns silently if the given Handler is not found.
+         * @param handler The Handler to remove
+         */
+        virtual void removeHandler( Handler* handler );
+
+        /**
+         * Gets a vector containing all the handlers that this class
+         * has been assigned to use.
+         * @returns a list of handlers that are used by this logger
+         */
+        // virtual const std::list<Handler*>& getHandlers(void) const;
+
+        /**
+         * Set a filter to control output on this Logger.
+         * <p>
+         * After passing the initial "level" check, the Logger will call
+         * this Filter to check if a log record should really be published.
+         * <p>
+         * The caller releases ownership of this filter to this logger
+         * @param filter to use, can be null
+         */
+        virtual void setFilter( Filter* filter );
+
+        /**
+         * Gets the Filter object that this class is using.
+         * @return the Filter in use, can be null
+         */
+        virtual const Filter* getFilter() const {
+            return filter;
+        }
+
+        /**
+         * Get the log Level that has been specified for this Logger. The
+         * result may be the Null level, which means that this logger's
+         * effective level will be inherited from its parent.
+         * @return the level that is currently set
+         */
+        virtual Level getLevel() const {
+            return level;
+        }
+
+        /**
+         * Set the log level specifying which message levels will be logged
+         * by this logger. Message levels lower than this value will be
+         * discarded. The level value Level.OFF can be used to turn off
+         * logging.
+         * <p>
+         * If the new level is the Null Level, it means that this node
+         * should inherit its level from its nearest ancestor with a
+         * specific (non-null) level value.
+         * @param level new Level value
+         */
+        virtual void setLevel( Level level ) {
+            this->level = level;
+        }
+
+        /**
+         * Discover whether or not this logger is sending its output to
+         * its parent logger.
+         * @return true if using Parent Handlers
+         */
+        virtual bool getUseParentHandlers() const {
+            return useParentHandlers;
+        }
+
+        /**
+         * pecify whether or not this logger should send its output to it's
+         * parent Logger. This means that any LogRecords will also be
+         * written to the parent's Handlers, and potentially to its parent,
+         * recursively up the namespace.
+         * @param value True is output is to be writen to the parent
+         */
+        virtual void setUseParentHandlers( bool value ) {
+            this->useParentHandlers = value;
+        }
+
+        /**
+         * Logs an Block Enter message
+         * <p>
+         * This is a convenience method that is used to tag a block enter, a
+         * log record with the class name function name and the string
+         * Entering is logged at the DEBUG log level.
+         * @param blockName source block name
+         * @param file source file name
+         * @param line source line name
+         */
+        virtual void entry( const std::string& blockName,
+                            const std::string& file,
+                            const int line );
+
+        /**
+         * Logs an Block Exit message
+         * <p>
+         * This is a convenience method that is used to tag a block exit, a
+         * log record with the class name function name and the string
+         * Exiting is logged at the DEBUG log level.
+         * @param blockName source block name
+         * @param file source file name
+         * @param line source line name
+         */
+        virtual void exit( const std::string& blockName,
+                           const std::string& file,
+                           const int line );
+
+        /**
+         * Log a Debug Level Log
+         * <p>
+         * If the logger is currently enabled for the DEBUG message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects.
+         * @param file the file name where the log was generated
+         * @param line the line number where the log was generated
+         * @param functionName name of the function that logged this
+         * @param message the message to log
+         */
+        virtual void debug( const std::string& file,
+                            const int line,
+                            const std::string functionName,
+                            const std::string& message );
+
+        /**
+         * Log a info Level Log
+         * <p>
+         * If the logger is currently enabled for the info message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects.
+         *
+         * @param file the file name where the log was generated
+         * @param line the line number where the log was generated
+         * @param functionName name of the function that logged this
+         * @param message the message to log
+         */
+        virtual void info( const std::string& file,
+                           const int line,
+                           const std::string functionName,
+                           const std::string& message );
+
+        /**
+         * Log a warn Level Log
+         * <p>
+         * If the logger is currently enabled for the warn message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects.
+         * @param file the file name where the log was generated
+         * @param line the line number where the log was generated
+         * @param functionName name of the function that logged this
+         * @param message the message to log
+         */
+        virtual void warn( const std::string& file,
+                           const int line,
+                           const std::string functionName,
+                           const std::string& message );
+
+        /**
+         * Log a error Level Log
+         * <p>
+         * If the logger is currently enabled for the error message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects.
+         * @param file the file name where the log was generated
+         * @param line the line number where the log was generated
+         * @param fnctionName name of the function that logged this
+         * @param message the message to log
+         */
+        virtual void error( const std::string& file,
+                            const int line,
+                            const std::string fnctionName,
+                            const std::string& message );
+
+        /**
+         * Log a fatal Level Log
+         * <p>
+         * If the logger is currently enabled for the fatal message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects.
+         * @param file the file name where the log was generated
+         * @param line the line number where the log was generated
+         * @param fnctionName name of the function that logged this
+         * @param message the message to log
+         */
+        virtual void fatal( const std::string& file,
+                            const int line,
+                            const std::string functionName,
+                            const std::string& message );
+
+        /**
+         * Log a Throw Message
+         * <p>
+         * If the logger is currently enabled for the Throwing message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects.
+         * @param file the file name where the log was generated
+         * @param line the line number where the log was generated
+         * @param fnctionName name of the function that logged this
+         * @param message the message to log
+        virtual void throwing( const std::string& file,
+                               const int line,
+                               const std::string fnctionName,
+                               const std::string& message );
+         */
+
+        /**
+         * Check if a message of the given level would actually be logged
+         * by this logger. This check is based on the Loggers effective
+         * level, which may be inherited from its parent.
+         * @param level - a message logging level
+         * @returns true if the given message level is currently being logged.
+         */
+        virtual bool isLoggable( Level level ) const;
+
+        /**
+         * Log a LogRecord.
+         * All the other logging methods in this class call through this
+         * method to actually perform any logging. Subclasses can override
+         * this single method to capture all log activity.
+         * @param record - the LogRecord to be published
+         */
+        virtual void log( LogRecord& record );
+
+        /**
+         * Log a message, with no arguments.
+         * <p>
+         * If the logger is currently enabled for the given message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects
+         * @param level the Level to log at
+         * @param message the message to log
+         */
+        virtual void log( Level level, const std::string& message );
+
+        /**
+         * Log a message, with the list of params that is formatted into
+         * the message string.
+         * <p>
+         * If the logger is currently enabled for the given message level
+         * then the given message is forwarded to all the registered output
+         * Handler objects
+         * @param level the Level to log at
+         * @param file the message to log
+         * @param line the line in the file
+         * @param variable length arguement to format the message string.
+         */
+        virtual void log( Level level,
+                          const std::string& file,
+                          const int line,
+                          const std::string& message, ... );
+
+        /**
+         * Log a message, with associated Throwable information.
+         * If the logger is currently enabled for the given message level
+         * then the given arguments are stored in a LogRecord which is
+         * forwarded to all registered output handlers.
+         * Note that the thrown argument is stored in the LogRecord thrown
+         * property, rather than the LogRecord parameters property. Thus is
+         * it processed specially by output Formatters and is not treated
+         * as a formatting parameter to the LogRecord message property.
+         * @param level the Level to log at
+         * @param file File that the message was logged in
+         * @param line the line number where the message was logged at.
+         * @param ex the Exception to log
+         */
+        virtual void log( Level level,
+                          const std::string& file,
+                          const int line,
+                          const std::string& message,
+                          lang::Exception& ex );
+
+    public:
+
+        /**
+         * Creates an anonymous logger
+         * <p>
+         * The newly created Logger is not registered in the LogManager
+         * namespace. There will be no access checks on updates to the
+         * logger.
+         * Even although the new logger is anonymous, it is configured to
+         * have the root logger ("") as its parent. This means that by
+         * default it inherits its effective level and handlers from the
+         * root logger.
+         * <p>
+         * The caller is responsible for destroying the returned logger.
+         * @return Newly created anonymous logger
+         */
+        static Logger* getAnonymousLogger();
+
+        /**
+         * Find or create a logger for a named subsystem. If a logger has
+         * already been created with the given name it is returned.
+         * Otherwise a new logger is created.
+         * <p>
+         * If a new logger is created its log level will be configured based
+         * on the LogManager and it will configured to also send logging
+         * output to its parent loggers Handlers. It will be registered in
+         * the LogManager global namespace.
+         * @param name - A name for the logger. This should be a
+         * dot-separated name and should normally be based on the package
+         * name or class name of the subsystem, such as cms or
+         * activemq.core.ActiveMQConnection
+         * @return a suitable logger.
+         */
+        static Logger* getLogger( const std::string& name );
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_LOGGER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerCommon.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerCommon.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerCommon.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerCommon.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_LOGGERCOMMON_H_
+#define _DECAF_UTIL_LOGGING_LOGGERCOMMON_H_
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    /**
+     * Defines an enumeration for logging levels
+     */
+    enum Level
+    {
+        Off,
+        Null,
+        Markblock,
+        Debug,
+        Info,
+        Warn,
+        Error,
+        Fatal,
+        Throwing
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_LOGGERCOMMON_H_ */

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerDefines.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerDefines.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerDefines.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerDefines.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_LOGGERDEFINES_H_
+#define _DECAF_UTIL_LOGGING_LOGGERDEFINES_H_
+
+#include <decaf/util/logging/SimpleLogger.h>
+#include <sstream>
+
+#define LOGDECAF_DECLARE(loggerName)                                  \
+   static decaf::util::logging::SimpleLogger loggerName;
+
+#define LOGDECAF_INITIALIZE(loggerName, className, loggerFamily)      \
+   decaf::util::logging::SimpleLogger className::loggerName(loggerFamily);
+
+#define LOGDECAF_DECLARE_LOCAL(loggerName)                            \
+   decaf::util::logging::Logger loggerName;
+
+#define LOGDECAF_DEBUG(logger, message)                               \
+   logger.debug(__FILE__, __LINE__, message);
+
+#define LOGDECAF_DEBUG_1(logger, message, value);                     \
+   {                                                                  \
+      std::ostringstream ostream;                                     \
+      ostream << message << value;                                    \
+      logger.debug(__FILE__, __LINE__, ostream.str());                \
+   }
+
+#define LOGDECAF_INFO(logger, message)                                \
+   logger.info(__FILE__, __LINE__, message);
+
+#define LOGDECAF_ERROR(logger, message)                               \
+   logger.error(__FILE__, __LINE__, message);
+
+#define LOGDECAF_WARN(logger, message)                                \
+   logger.warn(__FILE__, __LINE__, message);
+
+#define LOGDECAF_FATAL(logger, message)                               \
+   logger.fatal(__FILE__, __LINE__, message);
+
+
+#endif

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,29 @@
+/*
+* 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.
+*/
+
+#include "LoggerHierarchy.h"
+
+using namespace decaf::util::logging;
+
+////////////////////////////////////////////////////////////////////////////////
+LoggerHierarchy::LoggerHierarchy(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+LoggerHierarchy::~LoggerHierarchy(){
+}
+

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LoggerHierarchy.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,35 @@
+/*
+* 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.
+*/
+#ifndef _DECAF_UTIL_LOGGING_LOGGERHIERARCHY_H_
+#define _DECAF_UTIL_LOGGING_LOGGERHIERARCHY_H_
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    class LoggerHierarchy
+    {
+    public:
+
+        LoggerHierarchy();
+        virtual ~LoggerHierarchy();
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_LOGGERHIERARCHY_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/MarkBlockLogger.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/MarkBlockLogger.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/MarkBlockLogger.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/MarkBlockLogger.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_MARKBLOCKLOGGER_H_
+#define _DECAF_UTIL_LOGGING_MARKBLOCKLOGGER_H_
+
+#include <decaf/util/logging/Logger.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    /**
+     * Defines a class that can be used to mark the entry and exit from
+     * scoped blocks.
+     * <p>
+     * Create an instance of this class at the start of a scoped block,
+     * passing it the logger to use and the name of the block.  The block
+     * entry and exit will be marked using the scope name, logger to the
+     * logger at the MARKBLOCK log level.
+     */
+    class DECAF_API MarkBlockLogger
+    {
+    private:
+
+        // Pointer to the Logger to use for Logging
+        Logger* logger;
+
+        // Block Name to Log
+        std::string blockName;
+
+    public:
+
+        /**
+         * Constructor - Marks Block entry
+         * @param logger Logger to use
+         * @param blockName Block name
+         */
+        MarkBlockLogger(Logger* logger, const std::string& blockName)
+        {
+            this->logger = logger;
+            this->blockName = blockName;
+
+            logger.mark(blockName + " - Entered");
+        }
+
+        virtual ~MarkBlockLogger(void)
+        {
+            logger->mark(blockName + " - Exited");
+        }
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_MARKBLOCKLOGGER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/PropertiesChangeListener.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/PropertiesChangeListener.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/PropertiesChangeListener.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/PropertiesChangeListener.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_PROPERTIESCHANGELISTENER_H_
+#define _DECAF_UTIL_LOGGING_PROPERTIESCHANGELISTENER_H_
+
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+   /**
+    * Defines the interface that classes can use to listen for change
+    * events on Properties.
+    */
+   class DECAF_API PropertiesChangeListener
+   {
+   public:
+
+      virtual ~PropertiesChangeListener() {}
+
+      /**
+       * Change Event, called when a property is changed
+       * @param name - Name of the Property
+       * @param oldValue - Old Value of the Property
+       * @param newValue - New Value of the Property
+       */
+      virtual void onPropertyChanged( const std::string& name,
+                                      const std::string& oldValue,
+                                      const std::string& newValue ) = 0;
+
+   };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_PROPERTIESCHANGELISTENER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleFormatter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleFormatter.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleFormatter.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleFormatter.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_SIMPLEFORMATTER_H_
+#define _DECAF_UTIL_LOGGING_SIMPLEFORMATTER_H_
+
+#include <decaf/util/logging/formatter.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    /**
+     * Print a brief summary of the LogRecord in a human readable format.
+     * The summary will typically be 1 or 2 lines.
+     */
+    class DECAF_API SimpleFormatter : public Formatter {
+    public:
+
+        SimpleFormatter() {}
+        virtual ~SimpleFormatter() {}
+
+        /**
+         * Format the given log record and return the formatted string.
+         * @param record The Log Record to Format
+         */
+        virtual std::string format( const LogRecord& record ) const {
+            return "";
+        }
+
+        /**
+         * Format the message string from a log record.
+         * @param record The Log Record to Format
+         */
+         virtual std::string formatMessage( const LogRecord& record ) const{
+            return record.getMessage();
+        }
+
+        /**
+         * Return the header string for a set of formatted records.  In the
+         * default implementation this method should return empty string
+         * @param handler the target handler, can be null
+         * @return empty string
+         */
+        virtual std::string getHead( const Handler* handler ) {
+            return "";
+        }
+
+        /**
+         * Return the tail string for a set of formatted records.  In the
+         * default implementation this method should return empty string
+         * @param handler the target handler, can be null
+         * @return empty string
+         */
+        virtual std::string getTail( const Handler* handler ) {
+            return "";
+        }
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_SIMPLEFORMATTER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+#include "SimpleLogger.h"
+
+#include <iostream>
+#include <decaf/util/logging/LogWriter.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util::concurrent;
+using namespace decaf::util::logging;
+
+////////////////////////////////////////////////////////////////////////////////
+SimpleLogger::SimpleLogger( const std::string& name )
+{
+    this->name = name;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SimpleLogger::~SimpleLogger()
+{}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleLogger::mark( const std::string& message ) {
+    LogWriter::getInstance().log( "", 0, "", message );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleLogger::debug( const std::string& file,
+                          const int          line,
+                          const std::string& message ) {
+    LogWriter::getInstance().log( file, line, "DEBUG:", message );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleLogger::info( const std::string& file,
+                         const int          line,
+                         const std::string& message ) {
+    LogWriter::getInstance().log( file, line, "INFO:", message );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleLogger::warn( const std::string& file,
+                         const int          line,
+                         const std::string& message ) {
+    LogWriter::getInstance().log( file, line, "WARNING:", message );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleLogger::error( const std::string& file,
+                          const int          line,
+                          const std::string& message ) {
+    LogWriter::getInstance().log( file, line, "ERROR:", message );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleLogger::fatal( const std::string& file,
+                          const int          line,
+                          const std::string& message ) {
+    LogWriter::getInstance().log( file, line, "FATAL:", message );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleLogger::log(const std::string& message ) {
+    LogWriter::getInstance().log( message );
+}

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/SimpleLogger.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_SIMPLELOGGER_H_
+#define _DECAF_UTIL_LOGGING_SIMPLELOGGER_H_
+
+#include <string>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+   class DECAF_API SimpleLogger
+   {
+   public:
+
+      /**
+       * Constructor
+       */
+      SimpleLogger( const std::string& name );
+
+      /**
+       * Destructor
+       */
+      virtual ~SimpleLogger();
+
+      /**
+       * Log a Mark Block Level Log
+       */
+      virtual void mark(const std::string& message);
+
+      /**
+       * Log a Debug Level Log
+       */
+      virtual void debug(const std::string& file,
+                         const int          line,
+                         const std::string& message);
+
+      /**
+       * Log a Informational Level Log
+       */
+      virtual void info(const std::string& file,
+                        const int          line,
+                        const std::string& message);
+
+      /**
+       * Log a Warning Level Log
+       */
+      virtual void warn(const std::string& file,
+                        const int          line,
+                        const std::string& message);
+
+      /**
+       * Log a Error Level Log
+       */
+      virtual void error(const std::string& file,
+                         const int          line,
+                         const std::string& message);
+
+      /**
+       * Log a Fatal Level Log
+       */
+      virtual void fatal(const std::string& file,
+                         const int          line,
+                         const std::string& message);
+
+      /**
+       * No-frills log.
+       */
+      virtual void log(const std::string& message);
+
+   private:
+
+      // Name of this Logger
+      std::string name;
+
+   };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_SIMPLELOGGER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/StreamHandler.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/StreamHandler.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/StreamHandler.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/StreamHandler.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,218 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_LOGGING_STREAMHANDLER_H_
+#define _DECAF_UTIL_LOGGING_STREAMHANDLER_H_
+
+#include <decaf/util/logging/LoggerCommon.h>
+#include <decaf/util/logging/Handler.h>
+#include <decaf/util/logging/Formatter.h>
+#include <decaf/util/logging/Filter.h>
+#include <decaf/io/OutputStream.h>
+#include <decaf/kang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/InvalidStateException.h>
+#include <decaf/util/concurrent/Concurrent.h>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    class DECAF_API StreamHandler : public Handler {
+    private:
+
+        // OutputStream to write to
+        io::OutputStream* stream;
+
+        // Formats this Handlers output
+        Formatter* formatter;
+
+        // Filter object for Log Filtering
+        Filter* filter;
+
+    public:
+
+        /**
+         * Create a StreamHandler, with no current output stream.
+         */
+        StreamHandler() {
+            this->stream = NULL;
+            this->formatter = NULL;
+            this->filter = NULL;
+
+            this->level = Level::FATAL;  // We take everything by default
+        }
+
+        /**
+         * Create a StreamHandler, with no current output stream.
+         */
+        StreamHandler( io::OutputStream* stream, Formatter* formatter )
+        {
+            this->stream = stream;
+            this->formatter = formatter;
+            this->filter = NULL;
+
+           this->level = Level::Fatal;  // We take everything by default
+        }
+
+        /**
+         * Destructor
+         */
+        virtual ~StreamHandler() {
+            try {
+                this->close();
+            }
+            AMQ_CATCH_NOTHROW( lang::Exception)
+            AMQ_CATCALL_NOTHROW()
+        }
+
+        /**
+         * Close the current output stream.
+         * <p>
+         * The close method will perform a flush and then close the Handler.
+         * After close has been called this Handler  should no longer be used.
+         * Method calls may either be silently ignored or may throw runtime
+         * exceptions.
+         * @throw CMSException
+         */
+        virtual void close() throw ( cms::CMSException ) {
+            if( stream ) {
+                stream.flush();
+                stream.close();
+            }
+        }
+
+        /**
+         * Flush the Handler's output, clears any buffers.
+         */
+        virtual void flush() {
+            if(stream) {
+                stream->flush();
+            }
+        }
+
+        /**
+         * Publish the Log Record to this Handler
+         * @param The Log Record to Publish
+         */
+        virtual void publish( const LogRecord& record ) {
+
+            try {
+
+                if( !stream ) {
+                    throw lang::exceptions::NullPointerException(
+                        __FILE__, __LINE__,
+                        "StreamHandler::publish - Stream not set.");
+                }
+
+                // Check if we should log this record
+                if(isLoggable( record) ) {
+
+                    std::string log = formatter->format(record);
+
+                    synchronized(stream) {
+                        // Write the data to the stream
+                        stream->write(log.c_str(), log.length());
+                    }
+                }
+            }
+            AMQ_CATCH_RETHROW( lang::Exception )
+            AMQ_CATCHALL_THROW( lang::Exception )
+        }
+
+        /**
+         * Check if this Handler would actually log a given LogRecord.
+         * <p>
+         * @param <code>LogRecord</code> to check
+         */
+        virtual void isLoggable( const LogRecord& record ) {
+
+            if( filter ) {
+                // Allow for some filtering to occurr
+                return filter->isLoggable( record );
+            }
+
+            // By default we want everything that is greater than or
+            // equal to the set level of this Handler.
+            return record.level >= level;
+        }
+
+        /**
+         * Sets the Filter that this Handler uses to filter Log Records
+         * @param <code>Filter</code> derived instance
+         */
+        virtual void setFilter( const Filter* filter ){
+            this->filter = filter;
+        }
+
+        /**
+         * Gets the Filter that this Handler uses to filter Log Records
+         * @param <code>Filter</code> derived instance
+         */
+        virtual const Filter* getFilter(){
+            return filter;
+        }
+
+        /**
+         * Set the log level specifying which message levels will be logged
+         * by this Handler.
+         * <p>
+         * The intention is to allow developers to turn on voluminous logging,
+         * but to limit the messages that are sent to certain Handlers.
+         * @param Level enumeration value
+         */
+        virtual void setLevel( Level level ){
+            this->level = level;
+        }
+
+        /**
+         * Get the log level specifying which message levels will be logged
+         * by this Handler.
+         * @param Level enumeration value
+         */
+        virtual Level getLevel(){
+            return level;
+        }
+
+        /**
+         * Sets the <code>Formatter</code> used by this Handler
+         * @param <code>Filter</code> derived instance
+         */
+        virtual void setFormatter( const Formatter* formatter ){
+            this->formatter = formatter;
+        }
+
+        /**
+         * Gets the <code>Formatter</code> used by this Handler
+         * @param <code>Filter</code> derived instance
+         */
+        virtual const Formatter* getFormatter(){
+            return formatter;
+        }
+
+        /**
+         * Gets the output Stream that this Handler is using
+         * @return OuputStream pointer
+         */
+        virtual io::OutputStream* getOutputStream() const(
+            return stream;
+        }
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_STREAMHANDLER_H_*/

Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am?rev=652104&r1=652103&r2=652104&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/Makefile.am Tue Apr 29 13:52:30 2008
@@ -17,12 +17,26 @@
 
 cc_sources = \
   activemq/util/PrimitiveMapBenchmark.cpp \
+  decaf/lang/BooleanBenchmark.cpp \
+  decaf/util/PropertiesBenchmark.cpp \
+  decaf/util/QueueBenchmark.cpp \
+  decaf/util/SetBenchmark.cpp \
+  decaf/util/MapBenchmark.cpp \
+  decaf/io/DataInputStreamBenchmark.cpp \
+  decaf/io/DataOutputStreamBenchmark.cpp \
   benchmark/PerformanceTimer.cpp \
   testRegistry.cpp \
   main.cpp
 
 hh_sources = \
   activemq/util/PrimitiveMapBenchmark.h \
+  decaf/lang/BooleanBenchmark.h \
+  decaf/util/PropertiesBenchmark.h \
+  decaf/util/QueueBenchmark.h \
+  decaf/util/SetBenchmark.h \
+  decaf/util/MapBenchmark.h \
+  decaf/io/DataInputStreamBenchmark.h \
+  decaf/io/DataOutputStreamBenchmark.h \
   benchmark/BenchmarkBase.h \
   benchmark/PerformanceTimer.h
 
@@ -33,6 +47,6 @@
 ## Compiler/Linker Options
 ##
 activemq_test_benchmarks_SOURCES = $(cc_sources)
-activemq_test_benchmarks_CXXFLAGS = $(AMQ_TEST_CXXFLAGS) -I$(srcdir)/../main @CPPUNIT_CFLAGS@
-activemq_test_benchmarks_LDADD= $(AMQ_TEST_LIBS) @CPPUNIT_LIBS@
+activemq_test_benchmarks_CXXFLAGS = $(AMQ_TEST_CXXFLAGS) $(DECAF_TEST_CXXFLAGS) -I$(srcdir)/../main @CPPUNIT_CFLAGS@
+activemq_test_benchmarks_LDADD= $(AMQ_TEST_LIBS) $(DECAF_TEST_LIBS) @CPPUNIT_LIBS@
 

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+#include "DataInputStreamBenchmark.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::io;
+
+////////////////////////////////////////////////////////////////////////////////
+DataInputStreamBenchmark::DataInputStreamBenchmark(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamBenchmark::setUp(){
+
+    buffer = new unsigned char[bufferSize];
+
+    // init to full String Buffer
+    for( int ix = 0; ix < bufferSize - 1; ++ix ) {
+        buffer[ix] = 65;
+    }
+    buffer[bufferSize-1] = 0;
+    bis.setByteArray( buffer, bufferSize );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamBenchmark::tearDown(){
+
+    delete buffer;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataInputStreamBenchmark::run(){
+
+    DataInputStream dis( &bis );
+
+    bool boolResult = 0;
+    char charResult = 0;
+    unsigned char byteResult = 0;
+    unsigned short ushortResult = 0;
+    short shortResult = 0;
+    int intResult = 0;
+    long long longResult = 0;
+    double doubleResult = 0.0;
+    float floatResult = 0.0f;
+    std::string stringResult = "";
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( boolResult ); ++iy ){
+        boolResult = dis.readBoolean();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( charResult ); ++iy ){
+        charResult = dis.readChar();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( byteResult ); ++iy ){
+        byteResult = dis.readByte();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( ushortResult ); ++iy ){
+        ushortResult = dis.readUnsignedShort();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( shortResult ); ++iy ){
+        shortResult = dis.readShort();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( intResult ); ++iy ){
+        intResult = dis.readInt();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( longResult ); ++iy ){
+        longResult = dis.readLong();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( floatResult ); ++iy ){
+        floatResult = dis.readFloat();
+    }
+    bis.reset();
+
+    for( size_t iy = 0; iy < bufferSize / sizeof( doubleResult ); ++iy ){
+        doubleResult = dis.readDouble();
+    }
+    bis.reset();
+
+    for( int i = 0; i < 5; ++i ) {
+        stringResult = dis.readString();
+        bis.reset();
+    }
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_IO_DATAINPUTSTREAMBENCHMARK_H_
+#define _DECAF_IO_DATAINPUTSTREAMBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/ByteArrayInputStream.h>
+
+namespace decaf{
+namespace io{
+
+    class DataInputStreamBenchmark :
+        public benchmark::BenchmarkBase<
+            decaf::io::DataInputStreamBenchmark, DataInputStream >
+    {
+    private:
+
+        unsigned char* buffer;
+        static const int bufferSize = 200000;
+        ByteArrayInputStream bis;
+
+    public:
+
+        DataInputStreamBenchmark();
+        virtual ~DataInputStreamBenchmark() {}
+
+        virtual void setUp();
+        virtual void tearDown();
+        virtual void run();
+    };
+
+}}
+
+#endif /*_DECAF_IO_DATAINPUTSTREAMBENCHMARK_H_*/

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+#include "DataOutputStreamBenchmark.h"
+#include <decaf/io/ByteArrayOutputStream.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::io;
+
+////////////////////////////////////////////////////////////////////////////////
+DataOutputStreamBenchmark::DataOutputStreamBenchmark(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataOutputStreamBenchmark::setUp(){
+
+    for( size_t i = 0; i < 8096; ++i ) {
+        testString += 'a';
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DataOutputStreamBenchmark::run(){
+
+    std::vector<unsigned char> outputBuffer;
+    int numRuns = 500;
+
+    ByteArrayOutputStream bos( outputBuffer );
+    DataOutputStream dos( &bos );
+
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeLong( 0xFF00FF00FF00FF00LL );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeInt( 312568 );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeShort( 12568 );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeUnsignedShort( 12568 );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeBoolean( true );
+    }
+    for( int iy = 0; iy < numRuns * 40; ++iy ){
+        dos.writeDouble( 10.34235234 );
+    }
+    for( int iy = 0; iy < numRuns + 40; ++iy ){
+        dos.writeFloat( 32.4f );
+    }
+
+    outputBuffer.clear();
+
+    for( int iy = 0; iy < numRuns; ++iy ){
+        dos.writeChars( testString );
+        outputBuffer.clear();
+    }
+    for( int iy = 0; iy < numRuns; ++iy ){
+        dos.writeBytes( testString );
+        outputBuffer.clear();
+    }
+    for( int iy = 0; iy < numRuns; ++iy ){
+        dos.writeUTF( testString );
+        outputBuffer.clear();
+    }
+
+    outputBuffer.clear();
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_IO_DATAOUTPUTSTREAMBENCHMARK_H_
+#define _DECAF_IO_DATAOUTPUTSTREAMBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/io/DataOutputStream.h>
+
+namespace decaf{
+namespace io{
+
+    class DataOutputStreamBenchmark :
+        public benchmark::BenchmarkBase<
+        decaf::io::DataOutputStreamBenchmark, DataOutputStream >
+    {
+    private:
+
+        std::string testString;
+
+    public:
+
+        DataOutputStreamBenchmark();
+        virtual ~DataOutputStreamBenchmark() {}
+
+        virtual void setUp();
+        virtual void run();
+    };
+
+}}
+
+#endif /*_DECAF_IO_DATAOUTPUTSTREAMBENCHMARK_H_*/

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#include "BooleanBenchmark.h"
+
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+BooleanBenchmark::BooleanBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void BooleanBenchmark::run(){
+
+    int numRuns = 1000;
+    Boolean boolean( false );
+
+    std::string value = "";
+
+    for( int i = 0; i < numRuns; ++i ) {
+        value = boolean.toString();
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        value = boolean.toString( false );
+        value = boolean.toString( true );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        bool value1 = Boolean::parseBoolean( "false" );
+        bool value2 = Boolean::parseBoolean( "true" );
+
+        value = Boolean::valueOf( value1 ).toString();
+        value = Boolean::valueOf( value2 ).toString();
+    }
+
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/lang/BooleanBenchmark.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_LANG_BOOLEANBENCHMARK_H_
+#define _DECAF_LANG_BOOLEANBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/lang/Boolean.h>
+
+namespace decaf{
+namespace lang{
+
+    class BooleanBenchmark :
+        public benchmark::BenchmarkBase< decaf::lang::BooleanBenchmark, Boolean >
+    {
+    public:
+
+        BooleanBenchmark();
+        virtual ~BooleanBenchmark() {}
+
+        virtual void run();
+    };
+
+}}
+
+#endif /*_DECAF_LANG_BOOLEANBENCHMARK_H_*/

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+#include "MapBenchmark.h"
+#include <decaf/lang/Integer.h>
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+MapBenchmark::MapBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MapBenchmark::run() {
+
+    int numRuns = 500;
+    std::string test = "test";
+    std::string resultStr = "";
+    Map<std::string, std::string> stringCopy;
+    Map<int, int> intCopy;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) );
+        intMap.setValue( 100 + i, 100 + i );
+        stringMap.containsKey( test + Integer::toString(i) );
+        intMap.containsKey( 100 + i );
+        stringMap.containsValue( test + Integer::toString(i) );
+        intMap.containsValue( 100 + i );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringMap.remove( test + Integer::toString(i) );
+        intMap.remove( 100 + i );
+        stringMap.containsKey( test + Integer::toString(i) );
+        intMap.containsKey( 100 + i );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) );
+        intMap.setValue( 100 + i, 100 + i );
+    }
+
+    std::vector<std::string> stringVec;
+    std::vector<int> intVec;
+
+    for( int i = 0; i < numRuns / 2; ++i ) {
+        stringVec = stringMap.getKeys();
+        stringVec = stringMap.getValues();
+        intVec = intMap.getKeys();
+        intVec = intMap.getValues();
+    }
+
+    for( int i = 0; i < numRuns / 2; ++i ) {
+        stringCopy.copy( stringMap );
+        stringCopy.clear();
+        intCopy.copy( intMap );
+        intCopy.clear();
+    }
+
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_UTIL_MAPBENCHMARK_H_
+#define _DECAF_UTIL_MAPBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/util/Map.h>
+
+namespace decaf{
+namespace util{
+
+    class MapBenchmark :
+        public benchmark::BenchmarkBase<
+            decaf::util::MapBenchmark, Map<int, int> >
+    {
+    private:
+
+        Map< std::string, std::string> stringMap;
+        Map<int, int> intMap;
+
+    public:
+
+        MapBenchmark();
+        virtual ~MapBenchmark() {}
+
+        virtual void run();
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_MAPBENCHMARK_H_*/

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#include "PropertiesBenchmark.h"
+
+#include <decaf/lang/Integer.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+PropertiesBenchmark::PropertiesBenchmark() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void PropertiesBenchmark::run() {
+
+    int numRuns = 250;
+    std::string result = "";
+    bool hasIt = false;
+    Properties copy;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        properties.setProperty( "test", "value" );
+        hasIt = properties.hasProperty( "test" );
+        result = properties.getProperty( "test" );
+        properties.remove( "test" );
+    }
+
+    std::vector< std::pair< std::string, std::string > > array;
+
+    std::string prefix = "test";
+    for( int i = 0; i < numRuns; ++i ) {
+        properties.setProperty(
+            prefix + Integer::toString(i), prefix + Integer::toString(i) );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        array = properties.toArray();
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        copy.copy( &properties );
+        copy.clear();
+    }
+
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/PropertiesBenchmark.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_UTIL_PROPERTIESBENCHMARK_H_
+#define _DECAF_UTIL_PROPERTIESBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+
+#include <decaf/util/Properties.h>
+
+namespace decaf{
+namespace util{
+
+    class PropertiesBenchmark :
+        public benchmark::BenchmarkBase<
+            decaf::util::PropertiesBenchmark, Properties >
+    {
+    private:
+
+        Properties properties;
+
+    public:
+
+        PropertiesBenchmark();
+        virtual ~PropertiesBenchmark() {}
+
+        virtual void run();
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_PROPERTIESBENCHMARK_H_*/

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+#include "QueueBenchmark.h"
+
+#include <decaf/lang/Integer.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+QueueBenchmark::QueueBenchmark(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void QueueBenchmark::run(){
+
+    int numRuns = 300;
+    std::string test = "test";
+    std::string resultStr = "";
+    int resultInt = 0;
+    Queue<std::string> stringQCopy;
+    Queue<int> intQCopy;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringQ.push( test );
+        intQ.push( 65536 );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringQ.pop();
+        intQ.pop();
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringQ.enqueueFront( test );
+        intQ.enqueueFront( 1024 );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringQ.reverse( stringQCopy );
+        intQ.reverse( intQCopy );
+    }
+
+    std::vector<std::string> stringVec;
+    std::vector<int> intVec;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringVec = stringQ.toArray();
+        intVec = intQ.toArray();
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        resultStr = stringQ.front();
+        resultStr = stringQ.back();
+        resultInt = intQ.front();
+        resultInt = intQ.back();
+        stringQ.pop();
+        intQ.pop();
+    }
+
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_QUEUE_QUEUEBENCHMARK_H_
+#define _DECAF_QUEUE_QUEUEBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/util/Queue.h>
+
+namespace decaf{
+namespace util{
+
+    class QueueBenchmark :
+        public benchmark::BenchmarkBase<
+            decaf::util::QueueBenchmark, Queue<int> >
+    {
+    private:
+
+        Queue<std::string> stringQ;
+        Queue<int> intQ;
+
+    public:
+
+        QueueBenchmark();
+        virtual ~QueueBenchmark() {}
+
+        virtual void run();
+    };
+
+}}
+
+#endif /*_DECAF_QUEUE_QUEUEBENCHMARK_H_*/

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+#include "SetBenchmark.h"
+
+#include <decaf/lang/Integer.h>
+#include <decaf/util/Iterator.h>
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+SetBenchmark::SetBenchmark(){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SetBenchmark::run(){
+
+    int numRuns = 500;
+    std::string test = "test";
+    std::string resultStr = "";
+    Set<std::string> stringCopy;
+    Set<int> intCopy;
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringSet.add( test + Integer::toString(i) );
+        intSet.add( 100 + i );
+        stringSet.contains( test + Integer::toString(i) );
+        intSet.contains( 100 + i );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringSet.remove( test + Integer::toString(i) );
+        intSet.remove( 100 + i );
+        stringSet.contains( test + Integer::toString(i) );
+        intSet.contains( 100 + i );
+    }
+
+    for( int i = 0; i < numRuns; ++i ) {
+        stringSet.add( test + Integer::toString(i) );
+        intSet.add( 100 + i );
+    }
+
+    std::vector<std::string> stringVec;
+    std::vector<int> intVec;
+
+    for( int i = 0; i < numRuns / 2; ++i ) {
+        stringVec = stringSet.toArray();
+        intVec = intSet.toArray();
+    }
+
+    std::string tempStr = "";
+    int tempInt = 0;
+
+    for( int i = 0; i < numRuns / 2; ++i ) {
+
+        Iterator<std::string>* strIter = stringSet.iterator();
+        Iterator<int>* intIter = intSet.iterator();
+
+        while( strIter->hasNext() ){
+            tempStr = strIter->next();
+        }
+
+        while( intIter->hasNext() ){
+            tempInt = intIter->next();
+        }
+
+        delete strIter;
+        delete intIter;
+    }
+
+    for( int i = 0; i < numRuns / 2; ++i ) {
+        stringCopy.copy( stringSet );
+        stringCopy.clear();
+        intCopy.copy( intSet );
+        intCopy.clear();
+    }
+
+}

Added: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h (added)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_UTIL_SETBENCHMARK_H_
+#define _DECAF_UTIL_SETBENCHMARK_H_
+
+#include <benchmark/BenchmarkBase.h>
+#include <decaf/util/Set.h>
+
+namespace decaf{
+namespace util{
+
+    class SetBenchmark :
+        public benchmark::BenchmarkBase<
+            decaf::util::SetBenchmark, Set<int> >
+    {
+    private:
+
+        Set<int> intSet;
+        Set<std::string> stringSet;
+
+    public:
+
+        SetBenchmark();
+        virtual ~SetBenchmark() {}
+
+        virtual void run();
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_SETBENCHMARK_H_*/

Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp?rev=652104&r1=652103&r2=652104&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/testRegistry.cpp Tue Apr 29 13:52:30 2008
@@ -16,5 +16,21 @@
  */
 
 #include <activemq/util/PrimitiveMapBenchmark.h>
-
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::util::PrimitiveMapBenchmark );
+
+#include <decaf/lang/BooleanBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::BooleanBenchmark );
+
+#include <decaf/util/PropertiesBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::PropertiesBenchmark );
+#include <decaf/util/QueueBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::QueueBenchmark );
+#include <decaf/util/SetBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::SetBenchmark );
+#include <decaf/util/MapBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::MapBenchmark );
+
+#include <decaf/io/DataInputStreamBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataInputStreamBenchmark );
+#include <decaf/io/DataOutputStreamBenchmark.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataOutputStreamBenchmark );

Modified: activemq/activemq-cpp/trunk/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/Makefile.am?rev=652104&r1=652103&r2=652104&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/test/Makefile.am Tue Apr 29 13:52:30 2008
@@ -73,9 +73,102 @@
   activemq/util/PrimitiveMapTest.cpp \
   activemq/util/URISupportTest.cpp \
   activemq/util/LongSequenceGeneratorTest.cpp \
+  decaf/internal/util/ByteArrayAdapterTest.cpp \
+  decaf/internal/nio/ByteArrayPerspectiveTest.cpp \
+  decaf/internal/nio/ByteArrayBufferTest.cpp \
+  decaf/internal/nio/BufferFactoryTest.cpp \
+  decaf/internal/nio/CharArrayBufferTest.cpp \
+  decaf/internal/nio/DoubleArrayBufferTest.cpp \
+  decaf/internal/nio/FloatArrayBufferTest.cpp \
+  decaf/internal/nio/LongArrayBufferTest.cpp \
+  decaf/internal/nio/IntArrayBufferTest.cpp \
+  decaf/internal/nio/ShortArrayBufferTest.cpp \
+  decaf/lang/ByteTest.cpp \
+  decaf/lang/CharacterTest.cpp \
+  decaf/lang/BooleanTest.cpp \
+  decaf/lang/ShortTest.cpp \
+  decaf/lang/IntegerTest.cpp \
+  decaf/lang/LongTest.cpp \
+  decaf/lang/FloatTest.cpp \
+  decaf/lang/DoubleTest.cpp \
+  decaf/lang/ThreadTest.cpp \
+  decaf/lang/ExceptionTest.cpp \
+  decaf/lang/MathTest.cpp \
+  decaf/lang/SystemTest.cpp \
+  decaf/io/FilterInputStreamTest.cpp \
+  decaf/io/FilterOutputStreamTest.cpp \
+  decaf/io/BufferedInputStreamTest.cpp \
+  decaf/io/BufferedOutputStreamTest.cpp \
+  decaf/io/ByteArrayInputStreamTest.cpp \
+  decaf/io/ByteArrayOutputStreamTest.cpp \
+  decaf/io/DataInputStreamTest.cpp \
+  decaf/io/DataOutputStreamTest.cpp \
+  decaf/net/SocketFactoryTest.cpp \
+  decaf/net/SocketTest.cpp \
+  decaf/net/URITest.cpp \
+  decaf/net/URISyntaxExceptionTest.cpp \
+  decaf/util/StringTokenizerTest.cpp \
+  decaf/util/Endian.cpp \
+  decaf/util/DateTest.cpp \
+  decaf/util/UUIDTest.cpp \
+  decaf/util/RandomTest.cpp \
+  decaf/util/MapTest.cpp \
+  decaf/util/QueueTest.cpp \
+  decaf/util/SetTest.cpp \
+  decaf/util/concurrent/CountDownLatchTest.cpp \
+  decaf/util/concurrent/MutexTest.cpp \
+  decaf/util/concurrent/ThreadPoolTest.cpp \
+  decaf/nio/BufferTest.cpp \
+  testRegistry.cpp \
   main.cpp
 
-h_sources = 
+h_sources = \
+  decaf/internal/util/ByteArrayAdapterTest.h \
+  decaf/internal/nio/ByteArrayPerspectiveTest.h \
+  decaf/internal/nio/ByteArrayBufferTest.h \
+  decaf/internal/nio/BufferFactoryTest.h \
+  decaf/internal/nio/CharArrayBufferTest.h \
+  decaf/internal/nio/DoubleArrayBufferTest.h \
+  decaf/internal/nio/FloatArrayBufferTest.h \
+  decaf/internal/nio/LongArrayBufferTest.h \
+  decaf/internal/nio/IntArrayBufferTest.h \
+  decaf/internal/nio/ShortArrayBufferTest.h \
+  decaf/lang/ByteTest.h \
+  decaf/lang/CharacterTest.h \
+  decaf/lang/BooleanTest.h \
+  decaf/lang/ShortTest.h \
+  decaf/lang/IntegerTest.h \
+  decaf/lang/LongTest.h \
+  decaf/lang/FloatTest.h \
+  decaf/lang/DoubleTest.h \
+  decaf/lang/ThreadTest.h \
+  decaf/lang/ExceptionTest.h \
+  decaf/lang/MathTest.h \
+  decaf/lang/SystemTest.h \
+  decaf/io/FilterInputStreamTest.h \
+  decaf/io/FilterOutputStreamTest.h \
+  decaf/io/BufferedInputStreamTest.h \
+  decaf/io/BufferedOutputStreamTest.h \
+  decaf/io/ByteArrayInputStreamTest.h \
+  decaf/io/ByteArrayOutputStreamTest.h \
+  decaf/io/DataInputStreamTest.h \
+  decaf/io/DataOutputStreamTest.h \
+  decaf/net/SocketFactoryTest.h \
+  decaf/net/SocketTest.h \
+  decaf/net/URITest.h \
+  decaf/net/URISyntaxExceptionTest.h \
+  decaf/util/StringTokenizerTest.h \
+  decaf/util/Endian.h \
+  decaf/util/DateTest.h \
+  decaf/util/UUIDTest.h \
+  decaf/util/RandomTest.h \
+  decaf/util/MapTest.h \
+  decaf/util/QueueTest.h \
+  decaf/util/SetTest.h \
+  decaf/util/concurrent/CountDownLatchTest.h \
+  decaf/util/concurrent/MutexTest.h \
+  decaf/util/concurrent/ThreadPoolTest.h \
+  decaf/nio/BufferTest.h  
 
 include activemq/connector/openwire/marshal/v1/srcmakefile.mk
 include activemq/connector/openwire/marshal/v2/srcmakefile.mk
@@ -84,7 +177,7 @@
 check_PROGRAMS = activemq-test
 
 ## Also run the tests as part of make check
-TESTS = $(check_PROGRAMS)
+## TESTS = $(check_PROGRAMS)
 
 ## 
 ## Compiler/Linker Options
@@ -92,4 +185,3 @@
 activemq_test_SOURCES = $(cc_sources)
 activemq_test_CXXFLAGS = $(AMQ_TEST_CXXFLAGS) -I$(srcdir)/../main @CPPUNIT_CFLAGS@
 activemq_test_LDADD= $(AMQ_TEST_LIBS) @CPPUNIT_LIBS@ 
- 



Mime
View raw message