ACE_ OS: strcasecmp case-sensitive comparison
ACE_ OS: strncasecmp n-character case comparison
ACE: execname (prog1); execute the prog1 Program
ACE_ OS _String: strdup string deep copy
ACE_ OS: uname (& uname); get operating system information
ACE_Copy_Disabled: Non-Copy Base Class
ACE_DLL dynamic library class
ACE_Process_Options
ACE_Env_Value environment variable class
ACE_Obstack_T
ACE_Ptr pointer class
ACE_Refcounted_Auto_Ptr pointer reference count is the same as auto_ptr
ACE_Refcounted_Auto_Ptr_Rep
ACE_Auto_Basic_Ptr
ACE_Vector provides a vector similar to STL.
ACE_ARGV main Parameter processing class
ACE_ARGV cl (argv );
// My own stuff.
ACE_ARGV my;
// Add to my stuff.
My. add (ACE_TEXT ("-ORBEndpoint iiop: // localhost: 12345 "));
// Print the contents of the combined <ace_argv>.
For (INT I = 0; I <A. argc (); I ++)
Ace_debug (lm_debug,
Ace_text ("(% d) % s/n "),
I,
A. argv () [I]);
Ace_arg_shifter parameter construction conversion class
Const int test_argc_size = 5;
Int argl (test_argc_size );
Const ace_tchar * ARGs [test_argc_size] = {
Ace_text ("-known "),
Ace_text ("-Huh "),
Ace_text ("-Arg "),
Ace_text ("-what "),
ACE_TEXT ("arg ")
};
ACE_Arg_Shifter shifter (argl, args );
If (! Shifter. is_anything_left ())
ACE_ERROR (LM_ERROR, "is_anything_left () returned 0 at start./n "));
Static void consume_arg (int & argc, ACE_TCHAR * argv [])
{
ACE_Arg_Shifter arg_shifter (argc, argv );
If (arg_shifter.is_anything_left ())
Arg_shifter.consume_arg (1 );
// Once we initialize an arg_shifter, we must iterate through it all!
While (arg_shifter.is_anything_left ()))
Arg_shifter.ignore_arg (1 );
}
ACE_Get_Opt parameter option processing class
Static void
Parse_args (INT argc, ace_tchar * argv [])
{
Ace_get_opt get_opt (argc, argv, ace_text ("W: N :"));
Int C;
While (C = get_opt ())! =-1)
Switch (c)
{
Case 'W ':
N_workers = ace_ OS: atoi (get_opt.opt_arg ());
Break;
Case 'N ':
N_iterations = ACE_ OS: atoi (get_opt.opt_arg ());
Break;
Default:
Print_usage_and_die ();
Break;
}
}
ACE_Atomic_Op atomic operation class
ACE_Atomic_Op <ACE_Thread_Mutex, long> foo (5 );
Long result = ++ foo;
Result = -- foo;
ACE_Auto_IncDec automatically adds counters
ACE_Adaptive_Lock provides unified lock API
ACE_SString provides simple string operations
ACE_WString wide character class
Typedef of the ACE_TString character class
Char operator []
Char & operator []
ACE_SString substring
ACE_SString substr
U_long hash
Size_t length
Void rep (char * s) replace pointer in class
Int strstr
ACE_Auto_String_Free simple string pointer release class
Get pointer in class
Release releases pointer memory
The reset sets the pointer in the class to 0.
Ace_tokenizer string segmentation class
Char Buf [30];
Ace_ OS: strcpy (BUF, "William/Joseph/hagins ");
Ace_tokenizer Tok (BUF );
Tok. delimiter ('/');
For (char * P = Tok. Next (); P = Tok. Next ())
Cout <p <Endl;
Output
William/Joseph/hagins
Joseph/hagins
Hagins
Uuid_generator uniquely identifies the generator, such as the uuid of COM
UUID * generateuuid ()
Ace_time_value timer usage
Ace_time_value wait (0,
Iterations * 1000*100); // wait 'iter 'msec
Ace_time_value TV = ace_ OS: gettimeofday () + wait;
Ace_time_value diff = ace_ OS: gettimeofday ();
Diff = diff-TV; // TV shoshould have been reset to time acquired
Long diff_msec = diff. msec ();
// Wait a little longer each time
Static long wait_secs = 3;
Ace_time_value wait = ace_ OS: gettimeofday ();
Ace_time_value begin = wait;
Wait. Sec (wait. Sec () + wait_secs );
Ace_auto_event is like a Win32 event class.
Ace_event
Static void *
Worker (void *)
{
For (INT iterations = 1;
Iterations <= n_iterations;
Iterations ++)
{
Ace_time_value wait (0,
Iterations * 1000*100); // Wait 'iter 'msec
ACE_Time_Value TV = ACE_ OS: gettimeofday () + wait;
If (evt. wait (& TV) =-1)
{
// Verify that we have ETIME
ACE_ASSERT (ACE_ OS: last_error () = ETIME );
++ Timeouts;
ACE_Time_Value diff = ACE_ OS: gettimeofday ();
Diff = diff-TV; // TV shoshould have been reset to time acquired
Long diff_msec = diff. msec ();
If (diff_msec> ACE_ALLOWED_SLACK)
{
ACE_DEBUG (LM_DEBUG,
ACE_TEXT ("Acquire fails time reset test/n ")));
ACE_DEBUG (LM_DEBUG,
ACE_TEXT ("Diff btw now and returned time: % d MS/n "),
Diff. msec ()));
Test_result = 1;
}
// Hold the lock for a while.
ACE_ OS: sleep (ACE_Time_Value (0,
(Ace_ OS: rand () % 1000) * 1000 ));
EVT. Signal ();
}
Ace_thread: yield ();
}
Return 0;
}
Ace_auto_incdec
Typedef ACE_Atomic_Op <ACE_Thread_Mutex, int> INTERLOCKED_INT;
Static INTERLOCKED_INT current_threads_in_first_section;
Static INTERLOCKED_INT current_threads_in_second_section;
Static void *
Worker (void *)
{
ACE_DEBUG (LM_DEBUG,
ACE_TEXT ("(% t) worker starting/n ")));
{// First section.
Typedef ace_atomic_op <ace_thread_mutex, int> interlocked_int;
Static interlocked_int current_threads_in_first_section;
Ace_auto_incdec <interlocked_int> threads_in_section_auto_inc_dec
(Current_threads_in_first_section );
// Wait according to the number of threads...
Ace_time_value pause (current_threads_in_first_section.value (),
0 );
Ace_ OS: Sleep (pause );
}
{// Second section.
Ace_auto_incdec <interlocked_int> threads_in_section_auto_inc_dec
(Current_threads_in_second_section );
// Wait according to the number of threads inside the previous
// Section...
Ace_time_value pause (current_threads_in_first_section.value (),
0 );
Ace_ OS: Sleep (pause );
}
Ace_debug (lm_debug,
Ace_text ("(% t) Worker exiting/N ")));
Return 0;
}
ACE_Profile_Timer performance Timer
ACE_Profile_Timer timer;
ACE_Profile_Timer: ACE_Elapsed_Time elapsed_time;
Timer. start ();
Timer. stop ();
Timer. elapsed_time (elapsed_time );
ACE_High_Res_Timer high precision timer
ACE_High_Res_Timer timer;
Timer. reset ();
Timer. start ();
While (I --)
{
Ptr = allocator. malloc (chunk_size );
Allocator. free (ptr );
}
Timer. stop ();
Timer. elapsed_time (tc );
ACE_Base64 Base64 encoding class
ACE_Date_Time class
ACE_Date_Time dt;
Long month = dt. month ();
Long day = dt. day ();
Long year = dt. year ();
Long hour = dt. hour ();
Long minute = dt. minute ();
Long seconds = dt. second ();
Long usec = dt. microsec ();
Ace_di1__selector directory processing class
ACE_Thread_Manager thread Manager
Creation thread waiting for completion
ACE_Thread_Manager: instance ()-> spawn (wait_and_kill_dialog, m_pMainWnd );
ACE_Thread_Manager: instance ()-> wait ();