Timer.h
1 /***************************************************************************
2  * Copyright (C) 2005 by Tarek Taha *
3  * tataha@eng.uts.edu.au *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
19  ***************************************************************************/
20 
21 #ifndef TIMER_H_
22 #define TIMER_H_
23 
24 #if defined WIN32
25  #include <replace.h>
26  #include <Winsock2.h> // For struct timeval
27 #else
28  #include <sys/time.h>
29 #endif
30 #include <iostream>
31 
32 
34 {
35  private:
36  struct timeval start_time,end_time;
37  double time_diff;
38  public:
39  MricpTimer();
40  double TimeElapsed(); // time elapsed in usec since last call
41  void Reset(); // resets timer
42  virtual ~MricpTimer();
43  /* Synchronize the loop within a period
44  * To use this u will have to initialize the timer
45  * reset the timer at the beginning of the loop
46  * and call the Synch function at the end of the loop
47  */
48  void Synch(double period); // period should be in msec
49 };
50 
51 #endif /*TIMER_H_*/
52 
uint32_t key_count
Length of key in bytes.
Definition: player.h:268
uint8_t * data
Entry data.
Definition: player.h:282
PLAYERC_EXPORT int playerc_client_connect(playerc_client_t *client)
Connect to the server.
PLAYERC_EXPORT int playerc_blackboard_subscribe(playerc_blackboard_t *device, int access)
Subscribe to the blackboard device.
PLAYERC_EXPORT int playerc_blackboard_unsubscribe(playerc_blackboard_t *device)
Un-subscribe from the blackboard device.
PLAYERC_EXPORT int playerc_blackboard_unsubscribe_from_key(playerc_blackboard_t *device, const char *key, const char *group)
Unsubscribe from a key.
PLAYERC_EXPORT int playerc_blackboard_set_entry(playerc_blackboard_t *device, player_blackboard_entry_t *entry)
Set an entry value.
PLAYERC_EXPORT int playerc_blackboard_subscribe_to_key(playerc_blackboard_t *device, const char *key, const char *group, player_blackboard_entry_t **entry)
Subscribe to a key.
char * key
Identifier for the entry.
Definition: player.h:270
PLAYERC_EXPORT void playerc_client_destroy(playerc_client_t *client)
Destroy a client object.
PLAYERC_EXPORT playerc_blackboard_t * playerc_blackboard_create(playerc_client_t *client, int index)
Create a blackboard proxy.
PLAYERC_EXPORT int playerc_client_disconnect(playerc_client_t *client)
Disconnect from the server.
PLAYERC_EXPORT playerc_client_t * playerc_client_create(playerc_mclient_t *mclient, const char *host, int port)
Create a client object.
Client object data.
Definition: playerc.h:507
Definition: Timer.h:34
PLAYERC_EXPORT void * playerc_client_read(playerc_client_t *client)
Read data from the server (blocking).
Vectormap feature data.
Definition: player.h:266
struct player_blackboard_entry player_blackboard_entry_t
Vectormap feature data.
uint32_t data_count
Entry data length.
Definition: player.h:280
BlackBoard proxy.
Definition: playerc.h:1228
PLAYERC_EXPORT void playerc_blackboard_destroy(playerc_blackboard_t *device)
Destroy a blackboard proxy.