代码拉取完成,页面将自动刷新
#ifndef VRPN_LAMPORT_CLOCK_H
#define VRPN_LAMPORT_CLOCK_H
#include "vrpn_Configure.h" // for VRPN_API
#include "vrpn_Types.h" // for vrpn_uint32, vrpn_bool
/// @class vrpn_LamportTimestamp
/// Timestamp for a single event, produced by a vrpn_LamportClock and
/// hopefully generally usable in place of a struct timeval.
/// @class vrpn_LamportClock
/// Implements a distributed event clock as defined by Leslie Lamport in
/// some seminal papers I can't find my copies of, for use by people who
/// want to sequence events without relying on synchronization of wallclocks.
class VRPN_API vrpn_LamportTimestamp {
public:
vrpn_LamportTimestamp (int vectorLength, vrpn_uint32 * vector);
vrpn_LamportTimestamp (const vrpn_LamportTimestamp &);
~vrpn_LamportTimestamp (void);
vrpn_LamportTimestamp & operator = (const vrpn_LamportTimestamp &);
// ACCESSORS
vrpn_bool operator < (const vrpn_LamportTimestamp & r) const;
///< Returns vrpn_true if this timestamp precedes r.
///< It'd be nice if we could throw an exception here,
///< since some timestamps are incommesurate.
// Utility functions.
vrpn_uint32 operator [] (int i) const;
///< Returns the event count for the i'th host.
int size (void) const;
///< Returns the number of hosts participating in the timestamp.
private:
void copy (const vrpn_uint32 *);
///< Used by constructors and operator = to copy values into
///< d_timestamp; don't we wish we were using STL?
int d_timestampSize;
vrpn_uint32 * d_timestamp;
vrpn_LamportTimestamp (void);
///< UNDEFINED - not legal.
};
class VRPN_API vrpn_LamportClock {
public:
vrpn_LamportClock (int numHosts, int ourIndex);
~vrpn_LamportClock (void);
// MANIPULATORS
void receive (const vrpn_LamportTimestamp &);
///< Updates this clock to reflect a timestamp received from
///< another clock/host.
vrpn_LamportTimestamp * getTimestampAndAdvance (void);
///< Increments the current timestamp and returns it.
private:
int d_numHosts;
int d_ourIndex;
vrpn_uint32 * d_currentTimestamp;
};
#endif // VRPN_LAMPORT_CLOCK_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。