From activemq-commits-return-2549-apmail-geronimo-activemq-commits-archive=geronimo.apache.org@geronimo.apache.org Wed Jul 05 22:38:19 2006 Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 22853 invoked from network); 5 Jul 2006 22:38:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 22:38:19 -0000 Received: (qmail 98892 invoked by uid 500); 5 Jul 2006 22:38:08 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 98807 invoked by uid 500); 5 Jul 2006 22:38:08 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 98751 invoked by uid 99); 5 Jul 2006 22:38:07 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 15:38:07 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 15:37:59 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 71A831A982F; Wed, 5 Jul 2006 15:37:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r419371 [10/10] - in /incubator/activemq/trunk/openwire-cpp/src/main/cpp: activemq/ activemq/command/ activemq/protocol/ activemq/protocol/openwire/ activemq/transport/ activemq/transport/tcp/ cms/ ppr/ ppr/io/ ppr/io/encoding/ ppr/net/ ppr... Date: Wed, 05 Jul 2006 22:36:42 -0000 To: activemq-commits@geronimo.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060705223709.71A831A982F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Semaphore.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Semaphore.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Semaphore.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Semaphore.hpp Wed Jul 5 15:36:36 2006 @@ -1,240 +1,240 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_Semaphore_hpp_ -#define Ppr_Semaphore_hpp_ - -#if defined MACOSX -#include -#include -#include -#elif defined(__unix__) || defined(unix) -#ifndef unix -#define unix -#endif -#include -#include -#include -#endif -#if defined(WIN32) || defined(__CYGWIN__) && !defined unix -#if ( !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400) -#pragma message "Unsupported platform, Windows NT 4.0 or later required" -#endif -#include -#endif - -#ifdef _MSC_VER -#pragma warning( disable : 4100) // warning C4100: unreferenced formal parameter -#endif - -namespace apache -{ - namespace ppr - { - namespace thread - { - -/* - * - */ -class Semaphore -{ -private: -#ifdef MACOSX - // MacOSX lacks support for timedwait() on a semaphore. Need to build a semaphore upon a condition. - pthread_cond_t cond; - pthread_mutex_t mutex; - int counter; -#elif defined unix - sem_t semaphore ; -#else - HANDLE semaphore ; -#endif - -public: - Semaphore(int initialSize = 0) ; - ~Semaphore() ; - - void notify() ; - void notify(int count) ; - void wait() ; - bool wait(int timeout_sec, time_t now = -1) ; - bool trywait() ; -} ; - -// Optimize all methods via inline code - -inline Semaphore::Semaphore(int initialSize) -{ -#ifdef MACOSX - pthread_cond_init (&cond, NULL); - pthread_mutex_init (&mutex, NULL); - counter = initialSize; -#elif defined unix - sem_init(&semaphore, 0 /* local to process */, initialSize) ; -#else - semaphore = CreateSemaphore(NULL, initialSize, 1000000, NULL) ; -#endif -} - -inline Semaphore::~Semaphore() -{ -#ifdef MACOSX - pthread_mutex_destroy (&mutex); - pthread_cond_destroy (&cond); -#elif defined unix - sem_destroy(&semaphore) ; -#else - CloseHandle(semaphore) ; -#endif -} - -inline void Semaphore::notify() -{ -#ifdef MACOSX - pthread_mutex_lock (&mutex); - ++counter; - pthread_cond_signal (&cond); - pthread_mutex_unlock (&mutex); -#elif defined unix - sem_post(&semaphore) ; -#else - ReleaseSemaphore(semaphore, 1, NULL) ; -#endif -} - -inline void Semaphore::notify(int count) -{ -#ifdef MACOSX - pthread_mutex_lock (&mutex); - counter += count; - pthread_cond_signal (&cond); - pthread_mutex_unlock (&mutex); -#elif defined unix - while( count != 0 ) - { - sem_post(&semaphore) ; - --count ; - } -#else - ReleaseSemaphore(semaphore, count, NULL) ; -#endif -} - -inline void Semaphore::wait() -{ -#ifdef MACOSX - pthread_mutex_lock (&mutex); - while (counter == 0) { - pthread_cond_wait (&cond, &mutex); - } - --counter; - pthread_mutex_unlock (&mutex); -#elif defined unix - sem_wait(&semaphore) ; -#else - DWORD rc = WaitForSingleObject(semaphore, INFINITE) ; - assert(rc == WAIT_OBJECT_0) ; -#endif -} - -/* - * Waits specified number of seconds until it gives up. Returns false - * if semaphore is signaled, true when timeout is reached. - */ -inline bool Semaphore::wait(int timeout, time_t now) -{ -#ifdef MACOSX - if (now == -1) time(&now) ; - timespec ts ; - ts.tv_sec = now + timeout ; - ts.tv_nsec = 0 ; - - pthread_mutex_lock (&mutex); - while (counter == 0) { - if (pthread_cond_timedwait (&cond, &mutex, &ts) == ETIMEDOUT) { - pthread_mutex_unlock (&mutex); - return true; - } - } - --counter; - pthread_mutex_unlock (&mutex); - return true; -#elif defined unix - if (now == -1) - time(&now) ; - - timespec ts ; - ts.tv_sec = now + timeout ; - ts.tv_nsec = 0 ; - - do - { - int rc = sem_timedwait(&semaphore, &ts) ; - - if (rc == 0) - return false ; - - int errvalue = errno ; - - // Timeout occurred? - if ( errvalue == ETIMEDOUT) - return true ; - - assert(errvalue != EDEADLK) ; - assert(errvalue != EINVAL) ; - } - while( true ) ; - - return true ; -#else - DWORD rc = WaitForSingleObject(semaphore, timeout * 1000) ; - return (rc == WAIT_OBJECT_0 ? false : true) ; -#endif -} - -/* - * Returns false if some error occured or semaphore has zero count, true - * if semaphore successfully was decreased. - */ -inline bool Semaphore::trywait() -{ -#ifdef MACOSX - pthread_mutex_lock (&mutex); - if (counter == 0) { - pthread_mutex_unlock (&mutex); - return false; - } else { - --counter; - pthread_mutex_unlock (&mutex); - return true; - } -#elif defined unix - int rc = sem_trywait(&semaphore) ; - return ( rc == 0 ) ? true : false ; -#else - DWORD rc = WaitForSingleObject(semaphore, 0) ; - return (rc == WAIT_OBJECT_0 ? true : false) ; -#endif -} - -/* namespace */ - } - } -} - -#endif /*Ppr_Semaphore_hpp_*/ - +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_Semaphore_hpp_ +#define Ppr_Semaphore_hpp_ + +#if defined MACOSX +#include +#include +#include +#elif defined(__unix__) || defined(unix) +#ifndef unix +#define unix +#endif +#include +#include +#include +#endif +#if defined(WIN32) || defined(__CYGWIN__) && !defined unix +#if ( !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400) +#pragma message "Unsupported platform, Windows NT 4.0 or later required" +#endif +#include +#endif + +#ifdef _MSC_VER +#pragma warning( disable : 4100) // warning C4100: unreferenced formal parameter +#endif + +namespace apache +{ + namespace ppr + { + namespace thread + { + +/* + * + */ +class Semaphore +{ +private: +#ifdef MACOSX + // MacOSX lacks support for timedwait() on a semaphore. Need to build a semaphore upon a condition. + pthread_cond_t cond; + pthread_mutex_t mutex; + int counter; +#elif defined unix + sem_t semaphore ; +#else + HANDLE semaphore ; +#endif + +public: + Semaphore(int initialSize = 0) ; + ~Semaphore() ; + + void notify() ; + void notify(int count) ; + void wait() ; + bool wait(int timeout_sec, time_t now = -1) ; + bool trywait() ; +} ; + +// Optimize all methods via inline code + +inline Semaphore::Semaphore(int initialSize) +{ +#ifdef MACOSX + pthread_cond_init (&cond, NULL); + pthread_mutex_init (&mutex, NULL); + counter = initialSize; +#elif defined unix + sem_init(&semaphore, 0 /* local to process */, initialSize) ; +#else + semaphore = CreateSemaphore(NULL, initialSize, 1000000, NULL) ; +#endif +} + +inline Semaphore::~Semaphore() +{ +#ifdef MACOSX + pthread_mutex_destroy (&mutex); + pthread_cond_destroy (&cond); +#elif defined unix + sem_destroy(&semaphore) ; +#else + CloseHandle(semaphore) ; +#endif +} + +inline void Semaphore::notify() +{ +#ifdef MACOSX + pthread_mutex_lock (&mutex); + ++counter; + pthread_cond_signal (&cond); + pthread_mutex_unlock (&mutex); +#elif defined unix + sem_post(&semaphore) ; +#else + ReleaseSemaphore(semaphore, 1, NULL) ; +#endif +} + +inline void Semaphore::notify(int count) +{ +#ifdef MACOSX + pthread_mutex_lock (&mutex); + counter += count; + pthread_cond_signal (&cond); + pthread_mutex_unlock (&mutex); +#elif defined unix + while( count != 0 ) + { + sem_post(&semaphore) ; + --count ; + } +#else + ReleaseSemaphore(semaphore, count, NULL) ; +#endif +} + +inline void Semaphore::wait() +{ +#ifdef MACOSX + pthread_mutex_lock (&mutex); + while (counter == 0) { + pthread_cond_wait (&cond, &mutex); + } + --counter; + pthread_mutex_unlock (&mutex); +#elif defined unix + sem_wait(&semaphore) ; +#else + DWORD rc = WaitForSingleObject(semaphore, INFINITE) ; + assert(rc == WAIT_OBJECT_0) ; +#endif +} + +/* + * Waits specified number of seconds until it gives up. Returns false + * if semaphore is signaled, true when timeout is reached. + */ +inline bool Semaphore::wait(int timeout, time_t now) +{ +#ifdef MACOSX + if (now == -1) time(&now) ; + timespec ts ; + ts.tv_sec = now + timeout ; + ts.tv_nsec = 0 ; + + pthread_mutex_lock (&mutex); + while (counter == 0) { + if (pthread_cond_timedwait (&cond, &mutex, &ts) == ETIMEDOUT) { + pthread_mutex_unlock (&mutex); + return true; + } + } + --counter; + pthread_mutex_unlock (&mutex); + return true; +#elif defined unix + if (now == -1) + time(&now) ; + + timespec ts ; + ts.tv_sec = now + timeout ; + ts.tv_nsec = 0 ; + + do + { + int rc = sem_timedwait(&semaphore, &ts) ; + + if (rc == 0) + return false ; + + int errvalue = errno ; + + // Timeout occurred? + if ( errvalue == ETIMEDOUT) + return true ; + + assert(errvalue != EDEADLK) ; + assert(errvalue != EINVAL) ; + } + while( true ) ; + + return true ; +#else + DWORD rc = WaitForSingleObject(semaphore, timeout * 1000) ; + return (rc == WAIT_OBJECT_0 ? false : true) ; +#endif +} + +/* + * Returns false if some error occured or semaphore has zero count, true + * if semaphore successfully was decreased. + */ +inline bool Semaphore::trywait() +{ +#ifdef MACOSX + pthread_mutex_lock (&mutex); + if (counter == 0) { + pthread_mutex_unlock (&mutex); + return false; + } else { + --counter; + pthread_mutex_unlock (&mutex); + return true; + } +#elif defined unix + int rc = sem_trywait(&semaphore) ; + return ( rc == 0 ) ? true : false ; +#else + DWORD rc = WaitForSingleObject(semaphore, 0) ; + return (rc == WAIT_OBJECT_0 ? true : false) ; +#endif +} + +/* namespace */ + } + } +} + +#endif /*Ppr_Semaphore_hpp_*/ + Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Semaphore.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/SimpleMutex.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/SimpleMutex.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/SimpleMutex.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/SimpleMutex.hpp Wed Jul 5 15:36:36 2006 @@ -1,158 +1,158 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_SimpleMutex_hpp_ -#define Ppr_SimpleMutex_hpp_ - -#ifdef unix -#include -#endif -#if defined(WIN32) || defined(__CYGWIN__) && !defined unix -#if ( !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400) -#pragma message "Unsupported platform, Windows NT 4.0 or later required" -#endif -#include -#endif -#include - -#ifndef LOCKED_SCOPE -#define LOCKED_SCOPE(M) ::apache::ppr::thread::SimpleMutex::Lock _scope_lock_ (M) -#define LOCKED_SCOPE_UNLOCK _scope_lock_.unlock() -#define LOCKED_SCOPE_RELOCK _scope_lock_.relock() -#endif - - -namespace apache -{ - namespace ppr - { - namespace thread - { - -/* - * - */ -class SimpleMutex -{ -public: - class Lock { - private: - SimpleMutex* mutex; - bool locked; - public: - Lock (SimpleMutex& mutex) : mutex (&mutex), locked (true) { - mutex.lock(); - } - Lock (p& mutex) : mutex (getptr(mutex)), locked (true) { - mutex->lock(); - } - Lock (SimpleMutex* mutex) : mutex (mutex), locked (true) { - mutex->lock(); - } - ~Lock () { - if (locked) mutex->unlock(); - } - public: - void unlock () { - if (locked) { - mutex->unlock(); - locked = false; - } - } - void relock () { - if (!locked) { - mutex->lock(); - locked = true; - } - } - }; -private: -#ifdef unix - pthread_mutex_t mutex ; -#else - CRITICAL_SECTION mutex ; -#endif - -public: - SimpleMutex() ; - virtual ~SimpleMutex() ; - - bool trylock() ; - void lock() ; - void unlock() ; -} ; - -// Optimize all methods via inline code - -inline SimpleMutex::SimpleMutex() -{ -#ifdef unix - pthread_mutexattr_t attr ; - pthread_mutexattr_init(&attr) ; - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) ; - pthread_mutex_init(&mutex, &attr) ; - pthread_mutexattr_destroy(&attr) ; -#else - InitializeCriticalSection(&mutex) ; -#endif -} - -inline SimpleMutex::~SimpleMutex() -{ -#ifdef unix - pthread_mutex_destroy(&mutex) ; -#else - DeleteCriticalSection(&mutex) ; -#endif -} - -inline bool SimpleMutex::trylock() -{ -#ifdef unix - int try_l = pthread_mutex_trylock(&mutex) ; - if (try_l == 0) - return true; - else - return false ; -#else - return (TryEnterCriticalSection(&mutex) != 0) ; -#endif -} - -inline void SimpleMutex::lock() -{ -#ifdef unix - pthread_mutex_lock(&mutex) ; -#else - EnterCriticalSection(&mutex) ; -#endif -} - -inline void SimpleMutex::unlock() -{ -#ifdef unix - pthread_mutex_unlock(&mutex) ; -#else - LeaveCriticalSection(&mutex) ; -#endif -} - -/* namespace */ - } - } -} - -#endif /*Ppr_SimpleMutex_hpp_*/ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_SimpleMutex_hpp_ +#define Ppr_SimpleMutex_hpp_ + +#ifdef unix +#include +#endif +#if defined(WIN32) || defined(__CYGWIN__) && !defined unix +#if ( !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400) +#pragma message "Unsupported platform, Windows NT 4.0 or later required" +#endif +#include +#endif +#include + +#ifndef LOCKED_SCOPE +#define LOCKED_SCOPE(M) ::apache::ppr::thread::SimpleMutex::Lock _scope_lock_ (M) +#define LOCKED_SCOPE_UNLOCK _scope_lock_.unlock() +#define LOCKED_SCOPE_RELOCK _scope_lock_.relock() +#endif + + +namespace apache +{ + namespace ppr + { + namespace thread + { + +/* + * + */ +class SimpleMutex +{ +public: + class Lock { + private: + SimpleMutex* mutex; + bool locked; + public: + Lock (SimpleMutex& mutex) : mutex (&mutex), locked (true) { + mutex.lock(); + } + Lock (p& mutex) : mutex (getptr(mutex)), locked (true) { + mutex->lock(); + } + Lock (SimpleMutex* mutex) : mutex (mutex), locked (true) { + mutex->lock(); + } + ~Lock () { + if (locked) mutex->unlock(); + } + public: + void unlock () { + if (locked) { + mutex->unlock(); + locked = false; + } + } + void relock () { + if (!locked) { + mutex->lock(); + locked = true; + } + } + }; +private: +#ifdef unix + pthread_mutex_t mutex ; +#else + CRITICAL_SECTION mutex ; +#endif + +public: + SimpleMutex() ; + virtual ~SimpleMutex() ; + + bool trylock() ; + void lock() ; + void unlock() ; +} ; + +// Optimize all methods via inline code + +inline SimpleMutex::SimpleMutex() +{ +#ifdef unix + pthread_mutexattr_t attr ; + pthread_mutexattr_init(&attr) ; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) ; + pthread_mutex_init(&mutex, &attr) ; + pthread_mutexattr_destroy(&attr) ; +#else + InitializeCriticalSection(&mutex) ; +#endif +} + +inline SimpleMutex::~SimpleMutex() +{ +#ifdef unix + pthread_mutex_destroy(&mutex) ; +#else + DeleteCriticalSection(&mutex) ; +#endif +} + +inline bool SimpleMutex::trylock() +{ +#ifdef unix + int try_l = pthread_mutex_trylock(&mutex) ; + if (try_l == 0) + return true; + else + return false ; +#else + return (TryEnterCriticalSection(&mutex) != 0) ; +#endif +} + +inline void SimpleMutex::lock() +{ +#ifdef unix + pthread_mutex_lock(&mutex) ; +#else + EnterCriticalSection(&mutex) ; +#endif +} + +inline void SimpleMutex::unlock() +{ +#ifdef unix + pthread_mutex_unlock(&mutex) ; +#else + LeaveCriticalSection(&mutex) ; +#endif +} + +/* namespace */ + } + } +} + +#endif /*Ppr_SimpleMutex_hpp_*/ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/SimpleMutex.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Thread.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Thread.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Thread.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Thread.hpp Wed Jul 5 15:36:36 2006 @@ -1,133 +1,133 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_Thread_hpp_ -#define Ppr_Thread_hpp_ - -#ifdef unix -#include -#else -#include -#endif - -#include -#include -#include "ppr/util/ifr/p" - - -namespace apache -{ - namespace ppr - { - namespace thread - { - using namespace std; - using namespace ifr; - - -/** -*/ -struct IThread : Interface -{ - /** Creates a system thread and starts it in a joinable mode. - @exception runtime_error is thrown if the system could - not start the thread. - */ - virtual void start() throw (runtime_error) = 0; - - /** Wait til the thread exits. This is when the run() - method has returned or has threwn an exception. - If an exception was threwn in the run() method, - join() will return the threwn exception. Otherwise - (if run() returned normally), join() will - return NULL. - */ - virtual p join() = 0; -}; - -/** - * - */ -class Thread : public IThread -{ -private: -#ifdef unix - pthread_t threadHandle ; -#else - HANDLE threadHandle ; -#endif - /// true if thread is started. - bool started; - /// true if thread is joined - bool joined; - /// Exception threwn by run(). - p threwnException; -public: - /** Construct. - */ - Thread() ; - /** Destruct. - */ - virtual ~Thread() ; - - /** Creates a system thread and starts it in a joinable mode. - @exception runtime_error is thrown if the system could - not start the thread. - */ - virtual void start() throw (runtime_error); - - /** Wait til the thread exits. This is when the run() - method has returned or has threwn an exception. - If an exception was threwn in the run() method, - join() will return the threwn exception. Otherwise - (if run() returned normally), join() will - return NULL. - */ - virtual p join() ; -public: - /** Halts execution of the calling thread for a specified no of millisec. - - Note that this method is a static method that applies to the - calling thread and not to the thread object. - */ - static void sleep(int millisecs) ; -protected: - /** Derive from Thread and implement this method. This method will be - called by the thread that is created by start(). - - If an exception is threwn, the exception instance will be returned - by join(). If the same exception instance (and not a copy of it) - should be returned by join(), the implementation must throw - a pointer to heap where the exception resides like this: - throw p (new MyException()); - */ - virtual void run () throw (p) = 0; - -private: - // Internal thread handling -#ifdef unix - static void* internal_thread_function (void* param); -#else - static unsigned long WINAPI internal_thread_function (void* param); -#endif -} ; - -/* namespace */ - } - } -} - -#endif /*Ppr_Thread_hpp_*/ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_Thread_hpp_ +#define Ppr_Thread_hpp_ + +#ifdef unix +#include +#else +#include +#endif + +#include +#include +#include "ppr/util/ifr/p" + + +namespace apache +{ + namespace ppr + { + namespace thread + { + using namespace std; + using namespace ifr; + + +/** +*/ +struct IThread : Interface +{ + /** Creates a system thread and starts it in a joinable mode. + @exception runtime_error is thrown if the system could + not start the thread. + */ + virtual void start() throw (runtime_error) = 0; + + /** Wait til the thread exits. This is when the run() + method has returned or has threwn an exception. + If an exception was threwn in the run() method, + join() will return the threwn exception. Otherwise + (if run() returned normally), join() will + return NULL. + */ + virtual p join() = 0; +}; + +/** + * + */ +class Thread : public IThread +{ +private: +#ifdef unix + pthread_t threadHandle ; +#else + HANDLE threadHandle ; +#endif + /// true if thread is started. + bool started; + /// true if thread is joined + bool joined; + /// Exception threwn by run(). + p threwnException; +public: + /** Construct. + */ + Thread() ; + /** Destruct. + */ + virtual ~Thread() ; + + /** Creates a system thread and starts it in a joinable mode. + @exception runtime_error is thrown if the system could + not start the thread. + */ + virtual void start() throw (runtime_error); + + /** Wait til the thread exits. This is when the run() + method has returned or has threwn an exception. + If an exception was threwn in the run() method, + join() will return the threwn exception. Otherwise + (if run() returned normally), join() will + return NULL. + */ + virtual p join() ; +public: + /** Halts execution of the calling thread for a specified no of millisec. + + Note that this method is a static method that applies to the + calling thread and not to the thread object. + */ + static void sleep(int millisecs) ; +protected: + /** Derive from Thread and implement this method. This method will be + called by the thread that is created by start(). + + If an exception is threwn, the exception instance will be returned + by join(). If the same exception instance (and not a copy of it) + should be returned by join(), the implementation must throw + a pointer to heap where the exception resides like this: + throw p (new MyException()); + */ + virtual void run () throw (p) = 0; + +private: + // Internal thread handling +#ifdef unix + static void* internal_thread_function (void* param); +#else + static unsigned long WINAPI internal_thread_function (void* param); +#endif +} ; + +/* namespace */ + } + } +} + +#endif /*Ppr_Thread_hpp_*/ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/thread/Thread.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Endian.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Endian.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Endian.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Endian.hpp Wed Jul 5 15:36:36 2006 @@ -1,92 +1,92 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_Endian_hpp_ -#define Ppr_Endian_hpp_ - -#ifdef unix -#include -#else -#include -#endif -#include "ppr/util/ifr/endian" - -// Use these if the compiler does not support _intXX -#ifdef NEEDS_INT_DEFINED -#define _int16 short -#define _int32 int -#define _int64 long long -#endif - -namespace apache -{ - namespace ppr - { - namespace util - { - -// Macros and helpers for endian conversion -#ifdef IFR_IS_BIG_ENDIAN -inline unsigned int htoni (unsigned int i) { return i; } -inline unsigned long long htonll (unsigned long long ll) { return ll; } -inline float htonf (float f) { return f; } -inline double htond (double d) { return d; } -inline unsigned int ntohi (unsigned int i) { return i; } -inline unsigned long long ntohll (unsigned long long ll) { return ll; } -inline float ntohf (float f) { return f; } -inline double ntohd (double d) { return d; } -#else // !IFR_IS_BIG_ENDIAN - -inline unsigned int htoni (unsigned int i) { - return - ( i << 24 ) & 0xFF000000 | - ( i << 8 ) & 0x00FF0000 | - ( i >> 8 ) & 0x0000FF00 | - ( i >> 24 ) & 0x000000FF; -} - -inline unsigned long long htonll (unsigned long long ll) { - return - ( ll << 56 ) & 0xFF00000000000000ULL | - ( ll << 40 ) & 0x00FF000000000000ULL | - ( ll << 24 ) & 0x0000FF0000000000ULL | - ( ll << 8 ) & 0x000000FF00000000ULL | - ( ll >> 8 ) & 0x00000000FF000000ULL | - ( ll >> 24 ) & 0x0000000000FF0000ULL | - ( ll >> 40 ) & 0x000000000000FF00ULL | - ( ll >> 56 ) & 0x00000000000000FFULL; -} -inline float htonf (float f) { - unsigned int i = htoni( *(unsigned int *)&f ) ; - return *(float *)&i ; -} -inline double htond (double d) { - unsigned long long ll = htonll( *(unsigned long long *)&d ) ; - return *(double *)&ll ; -} -inline unsigned int ntohi (unsigned int i) { return htoni (i); } -inline unsigned long long ntohll (unsigned long long ll) { return htonll (ll); } -inline float ntohf (float f) { return htonf (f); } -inline double ntohd (double d) { return htond (d); } - -#endif // IFR_IS_BIG_ENDIAN - -/* namespace */ - } - } -} - -#endif /*Ppr_Endian_hpp_*/ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_Endian_hpp_ +#define Ppr_Endian_hpp_ + +#ifdef unix +#include +#else +#include +#endif +#include "ppr/util/ifr/endian" + +// Use these if the compiler does not support _intXX +#ifdef NEEDS_INT_DEFINED +#define _int16 short +#define _int32 int +#define _int64 long long +#endif + +namespace apache +{ + namespace ppr + { + namespace util + { + +// Macros and helpers for endian conversion +#ifdef IFR_IS_BIG_ENDIAN +inline unsigned int htoni (unsigned int i) { return i; } +inline unsigned long long htonll (unsigned long long ll) { return ll; } +inline float htonf (float f) { return f; } +inline double htond (double d) { return d; } +inline unsigned int ntohi (unsigned int i) { return i; } +inline unsigned long long ntohll (unsigned long long ll) { return ll; } +inline float ntohf (float f) { return f; } +inline double ntohd (double d) { return d; } +#else // !IFR_IS_BIG_ENDIAN + +inline unsigned int htoni (unsigned int i) { + return + ( i << 24 ) & 0xFF000000 | + ( i << 8 ) & 0x00FF0000 | + ( i >> 8 ) & 0x0000FF00 | + ( i >> 24 ) & 0x000000FF; +} + +inline unsigned long long htonll (unsigned long long ll) { + return + ( ll << 56 ) & 0xFF00000000000000ULL | + ( ll << 40 ) & 0x00FF000000000000ULL | + ( ll << 24 ) & 0x0000FF0000000000ULL | + ( ll << 8 ) & 0x000000FF00000000ULL | + ( ll >> 8 ) & 0x00000000FF000000ULL | + ( ll >> 24 ) & 0x0000000000FF0000ULL | + ( ll >> 40 ) & 0x000000000000FF00ULL | + ( ll >> 56 ) & 0x00000000000000FFULL; +} +inline float htonf (float f) { + unsigned int i = htoni( *(unsigned int *)&f ) ; + return *(float *)&i ; +} +inline double htond (double d) { + unsigned long long ll = htonll( *(unsigned long long *)&d ) ; + return *(double *)&ll ; +} +inline unsigned int ntohi (unsigned int i) { return htoni (i); } +inline unsigned long long ntohll (unsigned long long ll) { return htonll (ll); } +inline float ntohf (float f) { return htonf (f); } +inline double ntohd (double d) { return htond (d); } + +#endif // IFR_IS_BIG_ENDIAN + +/* namespace */ + } + } +} + +#endif /*Ppr_Endian_hpp_*/ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Endian.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Guid.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Guid.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Guid.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Guid.hpp Wed Jul 5 15:36:36 2006 @@ -1,61 +1,61 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_Guid_hpp_ -#define Ppr_Guid_hpp_ - -#include -#include - -#ifdef unix -#include -#endif -#include -#include -#if defined(WIN32) || defined(__CYGWIN__) -#include -#else -#include -#endif - -namespace apache -{ - namespace ppr - { - namespace util - { - using namespace std; - using namespace ifr; - -/* - * Helper class that generates global unique identifiers. - */ -class Guid -{ -private: - Guid() ; // This class shall never be instanciated. - -public: - static unsigned char* getGuid() ; - static p getGuidString() ; -} ; - -/* namespace */ - } - } -} - -#endif /*Ppr_Guid_hpp_*/ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_Guid_hpp_ +#define Ppr_Guid_hpp_ + +#include +#include + +#ifdef unix +#include +#endif +#include +#include +#if defined(WIN32) || defined(__CYGWIN__) +#include +#else +#include +#endif + +namespace apache +{ + namespace ppr + { + namespace util + { + using namespace std; + using namespace ifr; + +/* + * Helper class that generates global unique identifiers. + */ +class Guid +{ +private: + Guid() ; // This class shall never be instanciated. + +public: + static unsigned char* getGuid() ; + static p getGuidString() ; +} ; + +/* namespace */ + } + } +} + +#endif /*Ppr_Guid_hpp_*/ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Guid.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Hex.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Hex.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Hex.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Hex.hpp Wed Jul 5 15:36:36 2006 @@ -1,52 +1,52 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_Hex_hpp_ -#define Ppr_Hex_hpp_ - -#include -#include -#include - -namespace apache -{ - namespace ppr - { - namespace util - { - using namespace std; - using namespace ifr; - -/* - * Helper class with conversion routines. - */ -class Hex -{ -private: - Hex() ; - -public: - ~Hex() ; - - static p toString(array buffer) ; -} ; - -/* namespace */ - } - } -} - -#endif /*Ppr_Hex_hpp_*/ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_Hex_hpp_ +#define Ppr_Hex_hpp_ + +#include +#include +#include + +namespace apache +{ + namespace ppr + { + namespace util + { + using namespace std; + using namespace ifr; + +/* + * Helper class with conversion routines. + */ +class Hex +{ +private: + Hex() ; + +public: + ~Hex() ; + + static p toString(array buffer) ; +} ; + +/* namespace */ + } + } +} + +#endif /*Ppr_Hex_hpp_*/ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Hex.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/MapItemHolder.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/MapItemHolder.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/MapItemHolder.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/MapItemHolder.hpp Wed Jul 5 15:36:36 2006 @@ -1,102 +1,102 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_MapItemHolder_hpp_ -#define Ppr_MapItemHolder_hpp_ - -#include -#include -#include "ppr/ConversionException.hpp" -#include "ppr/util/ifr/array" -#include "ppr/util/ifr/p" - -// Turn off warning message for ignored exception specification -#ifdef _MSC_VER -#pragma warning( disable : 4290 ) -#endif - -namespace apache -{ - namespace ppr - { - namespace util - { - using namespace apache::ppr; - using namespace std; - using namespace ifr; - -/* - * - */ -class MapItemHolder -{ -private: - void* value ; - int type, - flags ; - - const static int BIT_DESTRUCT = 0x01000000; - const static int BIT_RELEASE_P_REFCOUNTED = BIT_DESTRUCT | 0x02000000; - //const static int BIT_RELEASE_P_VOID = BIT_DESTRUCT | 0x04000000; - -public: - const static int UNDEFINED = 0x00000000 ; - const static int BOOLEAN = 0x00000001 ; - const static int BYTE = 0x00000002 ; - const static int BYTEARRAY = 0x00000004 ; - const static int DOUBLE = 0x00000008 ; - const static int FLOAT = 0x00000010 ; - const static int INTEGER = 0x00000020 ; - const static int LONG = 0x00000040 ; - const static int SHORT = 0x00000080 ; - const static int STRING = 0x00000100 ; - -public: - MapItemHolder() ; - MapItemHolder(const MapItemHolder& other) ; - MapItemHolder& operator = (const MapItemHolder& other) ; - MapItemHolder(bool value) ; - MapItemHolder(char value) ; - MapItemHolder(array value) ; - MapItemHolder(double value) ; - MapItemHolder(float value) ; - MapItemHolder(int value) ; - MapItemHolder(long long value) ; - MapItemHolder(short value) ; - MapItemHolder(p value) ; - MapItemHolder(const char* value) ; - ~MapItemHolder() ; - - int getType() const ; - bool getBoolean() const throw (ConversionException) ; - char getByte() const throw (ConversionException) ; - array getBytes() const throw (ConversionException) ; - double getDouble() const throw (ConversionException) ; - float getFloat() const throw (ConversionException) ; - int getInt() const throw (ConversionException) ; - long long getLong() const throw (ConversionException) ; - short getShort() const throw (ConversionException) ; - p getString() const throw (ConversionException) ; -} ; - -typedef map PropertyMap ; - -/* namespace */ - } - } -} - -#endif /*Ppr_MapItemHolder_hpp_*/ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_MapItemHolder_hpp_ +#define Ppr_MapItemHolder_hpp_ + +#include +#include +#include "ppr/ConversionException.hpp" +#include "ppr/util/ifr/array" +#include "ppr/util/ifr/p" + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +namespace apache +{ + namespace ppr + { + namespace util + { + using namespace apache::ppr; + using namespace std; + using namespace ifr; + +/* + * + */ +class MapItemHolder +{ +private: + void* value ; + int type, + flags ; + + const static int BIT_DESTRUCT = 0x01000000; + const static int BIT_RELEASE_P_REFCOUNTED = BIT_DESTRUCT | 0x02000000; + //const static int BIT_RELEASE_P_VOID = BIT_DESTRUCT | 0x04000000; + +public: + const static int UNDEFINED = 0x00000000 ; + const static int BOOLEAN = 0x00000001 ; + const static int BYTE = 0x00000002 ; + const static int BYTEARRAY = 0x00000004 ; + const static int DOUBLE = 0x00000008 ; + const static int FLOAT = 0x00000010 ; + const static int INTEGER = 0x00000020 ; + const static int LONG = 0x00000040 ; + const static int SHORT = 0x00000080 ; + const static int STRING = 0x00000100 ; + +public: + MapItemHolder() ; + MapItemHolder(const MapItemHolder& other) ; + MapItemHolder& operator = (const MapItemHolder& other) ; + MapItemHolder(bool value) ; + MapItemHolder(char value) ; + MapItemHolder(array value) ; + MapItemHolder(double value) ; + MapItemHolder(float value) ; + MapItemHolder(int value) ; + MapItemHolder(long long value) ; + MapItemHolder(short value) ; + MapItemHolder(p value) ; + MapItemHolder(const char* value) ; + ~MapItemHolder() ; + + int getType() const ; + bool getBoolean() const throw (ConversionException) ; + char getByte() const throw (ConversionException) ; + array getBytes() const throw (ConversionException) ; + double getDouble() const throw (ConversionException) ; + float getFloat() const throw (ConversionException) ; + int getInt() const throw (ConversionException) ; + long long getLong() const throw (ConversionException) ; + short getShort() const throw (ConversionException) ; + p getString() const throw (ConversionException) ; +} ; + +typedef map PropertyMap ; + +/* namespace */ + } + } +} + +#endif /*Ppr_MapItemHolder_hpp_*/ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/MapItemHolder.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Time.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Time.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Time.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Time.hpp Wed Jul 5 15:36:36 2006 @@ -1,53 +1,53 @@ -/* - * Copyright 2006 The Apache Software Foundation or its licensors, as - * applicable. - * - * Licensed 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 Ppr_Time_hpp_ -#define Ppr_Time_hpp_ - -#ifdef unix -#include -#else -#include -#include -#endif - -namespace apache -{ - namespace ppr - { - namespace util - { - -/* - * Helper class with time functions. - */ -class Time -{ -private: - Time() ; - -public: - ~Time() ; - - static long long getCurrentTimeMillis() ; -} ; - -/* namespace */ - } - } -} - -#endif /*Ppr_Time_hpp_*/ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed 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 Ppr_Time_hpp_ +#define Ppr_Time_hpp_ + +#ifdef unix +#include +#else +#include +#include +#endif + +namespace apache +{ + namespace ppr + { + namespace util + { + +/* + * Helper class with time functions. + */ +class Time +{ +private: + Time() ; + +public: + ~Time() ; + + static long long getCurrentTimeMillis() ; +} ; + +/* namespace */ + } + } +} + +#endif /*Ppr_Time_hpp_*/ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/Time.hpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/array.hpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/atomic.hpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/cloneable.hpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/colltraits.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/endian.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/endian.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/endian.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/endian.hpp Wed Jul 5 15:36:36 2006 @@ -28,57 +28,57 @@ // First try - check __BYTE_ORDER macro #if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN -# ifdef unix -# include // defines __BYTE_ORDER (or sometimes __LITTLE_ENDIAN or __BIG_ENDIAN or __PDP_ENDIAN) -# endif -# if defined (__GLIBC__) -# include // Can also define __BYTE_ORDER -# endif -# ifdef __BYTE_ORDER -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define IFR_IS_LITTLE_ENDIAN -# elif __BYTE_ORDER == __BIG_ENDIAN -# define IFR_IS_BIG_ENDIAN -# elif __BYTE_ORDER == __PDP_ENDIAN -# define IFR_IS_PDP_ENDIAN -# endif -# endif -#endif - +# ifdef unix +# include // defines __BYTE_ORDER (or sometimes __LITTLE_ENDIAN or __BIG_ENDIAN or __PDP_ENDIAN) +# endif +# if defined (__GLIBC__) +# include // Can also define __BYTE_ORDER +# endif +# ifdef __BYTE_ORDER +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define IFR_IS_LITTLE_ENDIAN +# elif __BYTE_ORDER == __BIG_ENDIAN +# define IFR_IS_BIG_ENDIAN +# elif __BYTE_ORDER == __PDP_ENDIAN +# define IFR_IS_PDP_ENDIAN +# endif +# endif +#endif + // Second try - check __LITTLE_ENDIAN or __BIG_ENDIAN -#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN -# if defined __LITTLE_ENDIAN -# define IFR_IS_LITTLE_ENDIAN -# elif defined __BIG_ENDIAN -# define IFR_IS_BIG_ENDIAN -# elif defined __PDP_ENDIAN -# define IFR_IS_PDP_ENDIAN -# endif -#endif - -// Last try - find out from well-known processor types using little endian -#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN -# if defined (i386) || defined (__i386__) \ - || defined (_M_IX86) || defined (vax) \ - || defined (__alpha) || defined (__alpha__) \ - || defined (__x86_64__) || defined (__ia64) \ - || defined (__ia64__) || defined (__amd64__) \ - || defined (_M_IX86) || defined (_M_IA64) \ - || defined (_M_ALPHA) -# define IFR_IS_LITTLE_ENDIAN -# else -# if defined (__sparc) || defined(__sparc__) \ - || defined(_POWER) || defined(__powerpc__) \ - || defined(__ppc__) || defined(__hppa) \ - || defined(_MIPSEB) || defined(_POWER) \ - || defined(__s390__) -# define IFR_IS_BIG_ENDIAN -# endif -# endif -#endif +#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN +# if defined __LITTLE_ENDIAN +# define IFR_IS_LITTLE_ENDIAN +# elif defined __BIG_ENDIAN +# define IFR_IS_BIG_ENDIAN +# elif defined __PDP_ENDIAN +# define IFR_IS_PDP_ENDIAN +# endif +#endif + +// Last try - find out from well-known processor types using little endian +#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN +# if defined (i386) || defined (__i386__) \ + || defined (_M_IX86) || defined (vax) \ + || defined (__alpha) || defined (__alpha__) \ + || defined (__x86_64__) || defined (__ia64) \ + || defined (__ia64__) || defined (__amd64__) \ + || defined (_M_IX86) || defined (_M_IA64) \ + || defined (_M_ALPHA) +# define IFR_IS_LITTLE_ENDIAN +# else +# if defined (__sparc) || defined(__sparc__) \ + || defined(_POWER) || defined(__powerpc__) \ + || defined(__ppc__) || defined(__hppa) \ + || defined(_MIPSEB) || defined(_POWER) \ + || defined(__s390__) +# define IFR_IS_BIG_ENDIAN +# endif +# endif +#endif // Show error if we still don't know endianess -#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN -#error "Could not determine endianess of your processor type" -#endif - +#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN +#error "Could not determine endianess of your processor type" +#endif + Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/endian.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/namespace.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/namespace.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/namespace.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/namespace.hpp Wed Jul 5 15:36:36 2006 @@ -1,35 +1,35 @@ -/* - * Copyright (c) 2005-2006, David Fahlander - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. Redistributions in binary - * form must reproduce the above copyright notice, this list of conditions and - * the following disclaimer in the documentation and/or other materials provided - * with the distribution. Neither the name of slurk.org nor the names - * of its contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef IFR_V1_NAMESPACE_HPP_ -#define IFR_V1_NAMESPACE_HPP_ - -namespace ifr { - using namespace v1; -} - -#endif // IFR_V1_NAMESPACE_HPP_ +/* + * Copyright (c) 2005-2006, David Fahlander + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. Redistributions in binary + * form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided + * with the distribution. Neither the name of slurk.org nor the names + * of its contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef IFR_V1_NAMESPACE_HPP_ +#define IFR_V1_NAMESPACE_HPP_ + +namespace ifr { + using namespace v1; +} + +#endif // IFR_V1_NAMESPACE_HPP_ Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/namespace.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/p.hpp URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/p.hpp?rev=419371&r1=419370&r2=419371&view=diff ============================================================================== --- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/p.hpp (original) +++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/p.hpp Wed Jul 5 15:36:36 2006 @@ -264,8 +264,8 @@ /** Checks that static cast is valid and returns the ptr difference between them. */ - template struct ptr_diff { - static int value () { + template struct ptr_diff { + static int value () { return (int) (reinterpret_cast ( static_cast ( Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/p.hpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/util/ifr/v1/platform.hpp ------------------------------------------------------------------------------ svn:eol-style = native