activemq-cpp-3.9.5
System.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_LANG_SYSTEM_H_
19#define _DECAF_LANG_SYSTEM_H_
20
21#include <decaf/util/Config.h>
22#include <decaf/util/Map.h>
27#include <string>
28
29namespace decaf{
30namespace lang{
31
32 class Runtime;
33 class SystemData;
34
42 private:
43
44 static SystemData* sys;
45
46 protected:
47
49
50 public:
51
52 virtual ~System() {}
53
54 public: // Static Methods
55
74 static void arraycopy( const char* src, std::size_t srcPos,
75 char* dest, std::size_t destPos, std::size_t length );
76
95 static void arraycopy( const unsigned char* src, std::size_t srcPos,
96 unsigned char* dest, std::size_t destPos, std::size_t length );
97
116 static void arraycopy( const short* src, std::size_t srcPos,
117 short* dest, std::size_t destPos, std::size_t length );
118
137 static void arraycopy( const int* src, std::size_t srcPos,
138 int* dest, std::size_t destPos, std::size_t length );
139
158 static void arraycopy( const long long* src, std::size_t srcPos,
159 long long* dest, std::size_t destPos, std::size_t length );
160
179 static void arraycopy( const float* src, std::size_t srcPos,
180 float* dest, std::size_t destPos, std::size_t length );
181
200 static void arraycopy( const double* src, std::size_t srcPos,
201 double* dest, std::size_t destPos, std::size_t length );
202
221 template< typename E >
222 static void arraycopy( const E* src, std::size_t srcPos,
223 E* dest, std::size_t destPos, std::size_t length ) {
224
225 if( src == NULL ) {
227 __FILE__, __LINE__, "Given Source Pointer was null." );
228 }
229
230 if( src == NULL ) {
232 __FILE__, __LINE__, "Given Source Pointer was null." );
233 }
234
235 for( std::size_t i = 0; i < length; ++i ) {
236 dest[destPos+i] = src[srcPos+i];
237 }
238 }
239
249
261 static std::string getenv( const std::string& name );
262
271 static void unsetenv( const std::string& name );
272
283 static void setenv( const std::string& name, const std::string& value );
284
297 static long long currentTimeMillis();
298
321 static long long nanoTime();
322
333
344
358 static std::string getProperty( const std::string& key );
359
375 static std::string getProperty( const std::string& key, const std::string& defaultValue );
376
390 static std::string setProperty( const std::string& key, const std::string& value );
391
403 static std::string clearProperty( const std::string& key );
404
405 private:
406
414 static std::vector< std::string > getEnvArray();
415
421 static internal::AprPool& getAprPool();
422
423 private:
424
426
427 static void initSystem( int argc, char **argv );
428 static void shutdownSystem();
429
430 };
431
432}}
433
434#endif /*_DECAF_LANG_SYSTEM_H_*/
Wraps an APR pool object so that classes in decaf can create a static member for use in static method...
Definition AprPool.h:33
Definition Runtime.h:26
static decaf::util::Properties & getProperties()
Gets the Properties object that holds the Properties accessed from calls to getProperty and setProper...
static const util::Map< std::string, std::string > & getenv()
Enumerates the system environment and returns a map of env variable names to the string values they h...
static void arraycopy(const E *src, std::size_t srcPos, E *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
Definition System.h:222
static void arraycopy(const long long *src, std::size_t srcPos, long long *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
static long long nanoTime()
Returns the current value of the most precise available system timer, in nanoseconds.
static std::string clearProperty(const std::string &key)
Clear any value associated with the system property specified.
static void arraycopy(const float *src, std::size_t srcPos, float *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
static void arraycopy(const double *src, std::size_t srcPos, double *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
static void arraycopy(const char *src, std::size_t srcPos, char *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
static void arraycopy(const unsigned char *src, std::size_t srcPos, unsigned char *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
static long long currentTimeMillis()
Returns the current time in milliseconds.
static std::string getProperty(const std::string &key)
Gets the specified System property if set, otherwise returns an empty string.
static void arraycopy(const short *src, std::size_t srcPos, short *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
virtual ~System()
Definition System.h:52
static void arraycopy(const int *src, std::size_t srcPos, int *dest, std::size_t destPos, std::size_t length)
Copies the number of elements specified by length from the source array starting at the given source ...
static int availableProcessors()
Returns the number of processors available for execution of Decaf Threads.
static void setenv(const std::string &name, const std::string &value)
Sets the specified system property to the value given.
static std::string getenv(const std::string &name)
Reads an environment value from the system and returns it as a string object.
static void unsetenv(const std::string &name)
Clears a set environment value if one is set.
static std::string setProperty(const std::string &key, const std::string &value)
Sets the System Property to the specified value.
static std::string getProperty(const std::string &key, const std::string &defaultValue)
Gets the specified System property if set, otherwise returns the specified default value.
Definition NullPointerException.h:32
An object that maps keys to values.
Definition Map.h:88
Java-like properties class for mapping string names to string values.
Definition Properties.h:53
#define NULL
Definition Config.h:33
#define DECAF_API
Definition Config.h:29
Definition ThreadingTypes.h:31
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25