This object specifies which peers should be playing which notes. More...
#include <NoteAssignmentsMap.h>

Public Member Functions | |
| NoteAssignmentsMap () | |
| Constructor. More... | |
| ~NoteAssignmentsMap () | |
| Destructor. More... | |
| virtual void | SetToDefaultState () |
| Sets this object to its just-constructed state. More... | |
| virtual status_t | SetFromArchive (const ConstMessageRef &archive) |
| Replaces this map's current contents with the contents from (archive) More... | |
| virtual status_t | SaveToArchive (const MessageRef &archive) const |
| Saves this map's current contents into (archive) More... | |
| const Hashtable< ZGPeerID, uint64 > & | GetNoteAssignments () const |
| For a given peer, returns the chord of notes that peer should play. More... | |
| uint64 | GetNoteAssignmentsForPeerID (const ZGPeerID &peerID) const |
| Returns the note-assignments currently specified for the given peer. More... | |
| status_t | SetNoteAssignmentsForPeerID (const ZGPeerID &peerID, uint64 newNotes) |
| Sets the notes-chord for the given peer ID to the given value. More... | |
| void | UnassignNote (uint32 noteIdx) |
| Un-assigns the specified note from everybody. More... | |
| uint64 | GetAllAssignedNotesChord () const |
| Returns a bit-chord showing which notes are currently assigned to at least one peer. More... | |
| void | SetAssignmentStrategy (uint32 strategy) |
| Set the assignment strategy we want the system to use for bell-assignments. More... | |
| uint32 | GetAssignmentStrategy () const |
| Returns the assignment strategy the system is using for bell-assignments. More... | |
| virtual uint32 | GetCurrentChecksum () const |
| Returns the checksum of this object (which is updated whenever this object's contents change) More... | |
| virtual uint32 | CalculateChecksum () const |
| Recalculates our checksum from scratch (expensive!) More... | |
| virtual ConstMessageRef | SeniorUpdate (const ConstMessageRef &seniorDoMsg) |
| Updates our state as specified in the (seniorDoMsg). More... | |
| virtual status_t | JuniorUpdate (const ConstMessageRef &juniorDoMsg) |
| Updates our state as specified in the (juniorDoMsg). More... | |
| status_t | HandleToggleAssignmentMessage (const Message &msg) |
| Updates this object based on the given CHOIR_COMMAND_TOGGLE_ASSIGNMENT Message's contents. More... | |
| void | PrintToStream () const |
| For debugging purposes. More... | |
| virtual String | ToString () const |
| Returns a string representation of this object, for debugging purposes. More... | |
| const Hashtable< uint8, uint32 > & | GetNoteHistogram () const |
| Returns a table that shows for each note currently in use, how many peers are currently assigned to play that note. More... | |
| ZGDatabasePeerSession * | GetDatabasePeerSession () |
| Returns a pointer to the ZGDatabasePeerSession object that created us, or NULL if this object was not created by a ZGDatabasePeerSession. More... | |
| const ZGDatabasePeerSession * | GetDatabasePeerSession () const |
| As above, but returns a const/read-only pointer. More... | |
Protected Member Functions | |
| ChoirSession * | GetChoirSession () |
| Returns a pointer to the ChoirSession object that created this object. More... | |
| const ChoirSession * | GetChoirSession () const |
| Returns a read-only pointer to the ChoirSession object that created this object. More... | |
| ConstMessageRef | SendFullStateToGUI (bool allowReviewTrigger) |
| Saves the state of this object into a Message and sends that Message to the GUI thread. More... | |
| void | SendMessageToGUI (const ConstMessageRef &msg, bool allowReviewTrigger) |
| Sends the specified Message to the GUI thread. More... | |
| void | SetReviewResults (uint64 allNotesUsedChord) |
| Convenience method; calls SetReviewResults(allNotesUsedChord) on our ChoirSession object. More... | |
| const IDatabaseObject * | GetDatabaseObject (uint32 whichDatabase) const |
| Returns a read-only pointer to the specified IDatabaseObject held by our ZGDatabasePeerSession, or NULL if we don't have a ZGDatabasePeerSession or if the specified database doesn't exist. More... | |
| bool | IsPeerOnline (const ZGPeerID &pid) const |
| Returns true iff the peer with the specified ID is currently on line. More... | |
| const Hashtable< ZGPeerID, ConstMessageRef > & | GetOnlinePeers () const |
| Returns a table of the currently online peers (and their attributes), or an empty table if we have no ZGDatabasePeerSession. More... | |
| virtual uint64 | GetNetworkTime64 () const |
| Returns the current network time, or 0 if we have no ZGDatabasePeerSession. More... | |
| virtual uint64 | GetRunTime64ForNetworkTime64 (uint64 networkTime64TimeStamp) const |
| Returns the local time corresponding to a given network time, or 0 if we have no ZGDatabasePeerSession. More... | |
| virtual uint64 | GetNetworkTime64ForRunTime64 (uint64 runTime64TimeStamp) const |
| Returns the network time corresponding to a given local time, or 0 if we have no ZGDatabasePeerSession. More... | |
| virtual int64 | GetToNetworkTimeOffset () const |
| Returns the number of microseconds that should be added to a GetRunTime64() value to turn it into a GetNetworkTime64() value, or subtracted to do the inverse operation. More... | |
This object specifies which peers should be playing which notes.
Definition at line 9 of file NoteAssignmentsMap.h.
Constructor.
| ~NoteAssignmentsMap | ( | ) |
Destructor.
|
virtual |
Recalculates our checksum from scratch (expensive!)
Implements IDatabaseObject.
|
inline |
Returns a bit-chord showing which notes are currently assigned to at least one peer.
Definition at line 40 of file NoteAssignmentsMap.h.
|
inline |
Returns the assignment strategy the system is using for bell-assignments.
Default value is ASSIGNMENT_STRATEGY_AUTOMATIC.
Definition at line 48 of file NoteAssignmentsMap.h.
|
protectedinherited |
Returns a pointer to the ChoirSession object that created this object.
|
protectedinherited |
Returns a read-only pointer to the ChoirSession object that created this object.
|
inlinevirtual |
Returns the checksum of this object (which is updated whenever this object's contents change)
Implements IDatabaseObject.
Definition at line 51 of file NoteAssignmentsMap.h.
|
protectedinherited |
Returns a read-only pointer to the specified IDatabaseObject held by our ZGDatabasePeerSession, or NULL if we don't have a ZGDatabasePeerSession or if the specified database doesn't exist.
| whichDatabase | index of the database object we want to access |
|
inlineinherited |
Returns a pointer to the ZGDatabasePeerSession object that created us, or NULL if this object was not created by a ZGDatabasePeerSession.
(Note that this pointer is not set until after our constructor returns, this method will always return NULL if called from a constructor)
Definition at line 85 of file IDatabaseObject.h.
|
inlineinherited |
As above, but returns a const/read-only pointer.
Definition at line 88 of file IDatabaseObject.h.
|
protectedvirtualinherited |
Returns the current network time, or 0 if we have no ZGDatabasePeerSession.
Implements INetworkTimeProvider.
|
protectedvirtualinherited |
Returns the network time corresponding to a given local time, or 0 if we have no ZGDatabasePeerSession.
| runTime64TimeStamp | a local-clock time, in microseconds |
Implements INetworkTimeProvider.
|
inline |
For a given peer, returns the chord of notes that peer should play.
Definition at line 28 of file NoteAssignmentsMap.h.
|
inline |
Returns the note-assignments currently specified for the given peer.
Definition at line 31 of file NoteAssignmentsMap.h.
|
inline |
Returns a table that shows for each note currently in use, how many peers are currently assigned to play that note.
(Keys are CHOIR_NOTE_* values, Values are assignment-counts, unassigned notes are not included in the table)
Definition at line 81 of file NoteAssignmentsMap.h.
|
protectedinherited |
Returns a table of the currently online peers (and their attributes), or an empty table if we have no ZGDatabasePeerSession.
|
protectedvirtualinherited |
Returns the local time corresponding to a given network time, or 0 if we have no ZGDatabasePeerSession.
| networkTime64TimeStamp | a network-clock time, in microseconds |
Implements INetworkTimeProvider.
|
protectedvirtualinherited |
Returns the number of microseconds that should be added to a GetRunTime64() value to turn it into a GetNetworkTime64() value, or subtracted to do the inverse operation.
Note that this value will vary from one moment to the next!
Implements INetworkTimeProvider.
| status_t HandleToggleAssignmentMessage | ( | const Message & | msg | ) |
Updates this object based on the given CHOIR_COMMAND_TOGGLE_ASSIGNMENT Message's contents.
|
protectedinherited |
Returns true iff the peer with the specified ID is currently on line.
| pid | The ID of the peer we are interested in. If we have no ZGDatabasePeerSession then this will always return false. |
|
virtual |
Updates our state as specified in the (juniorDoMsg).
Will only be called on the instance running on the senior peer.
| juniorDoMsg | A Message containing instructions for how to update our state on a junior peer. |
Implements IDatabaseObject.
| void PrintToStream | ( | ) | const |
For debugging purposes.
|
virtual |
Saves this map's current contents into (archive)
Implements IDatabaseObject.
|
protectedinherited |
Saves the state of this object into a Message and sends that Message to the GUI thread.
| allowReviewTrigger | if true, this method may also trigger a review of the current bell-assignments to see if they need updating. |
|
protectedinherited |
Sends the specified Message to the GUI thread.
| msg | The Message to send to the GUI thread. |
| allowReviewTrigger | if true, this method may also trigger a review of the current bell-assignments to see if they need updating. |
|
virtual |
Updates our state as specified in the (seniorDoMsg).
Will only be called on the instance running on the senior peer.
| seniorDoMsg | A Message containing instructions for how to update our state on the senior peer. |
Implements IDatabaseObject.
| void SetAssignmentStrategy | ( | uint32 | strategy | ) |
Set the assignment strategy we want the system to use for bell-assignments.
| strategy | a ASSIGNMENT_STRATEGY_* value |
|
virtual |
Replaces this map's current contents with the contents from (archive)
Implements IDatabaseObject.
| status_t SetNoteAssignmentsForPeerID | ( | const ZGPeerID & | peerID, |
| uint64 | newNotes | ||
| ) |
Sets the notes-chord for the given peer ID to the given value.
|
protectedinherited |
Convenience method; calls SetReviewResults(allNotesUsedChord) on our ChoirSession object.
| allNotesUsedChord | a bit-chord of CHOIR_NOTE_* values indicating which notes are present in our current song. |
|
virtual |
Sets this object to its just-constructed state.
Implements IDatabaseObject.
|
virtual |
Returns a string representation of this object, for debugging purposes.
Implements IDatabaseObject.
| void UnassignNote | ( | uint32 | noteIdx | ) |
Un-assigns the specified note from everybody.
1.8.8