A slight specialization of the IDatabaseObject class, just so I can add some application-specific helper methods for my various subclasses to all use.
More...
#include <MusicData.h>
|
| MusicDatabaseObject () |
| Default constructor. More...
|
|
virtual void | SetToDefaultState ()=0 |
| Should be implemented to set this object to its default/just-default-constructed state. More...
|
|
virtual status_t | SetFromArchive (const ConstMessageRef &archive)=0 |
| Should be implemented to replace this object's entire state with the state contained in (archive) More...
|
|
virtual status_t | SaveToArchive (const MessageRef &archive) const =0 |
| Should be implemented to save this object's entire state into (archive). More...
|
|
virtual uint32 | GetCurrentChecksum () const =0 |
| Should return the current checksum of this object. More...
|
|
virtual uint32 | CalculateChecksum () const =0 |
| This method should be implemented to recalculate the database's current checksum from scratch. More...
|
|
virtual ConstMessageRef | SeniorUpdate (const ConstMessageRef &seniorDoMsg)=0 |
| Should update this object's state using the passed-in senior-do-Message (whose semantics are left up to the subclass to define), and then return a reference to a Message that can be used later to update the junior copies of this database to the same final state that this object is now in. More...
|
|
virtual status_t | JuniorUpdate (const ConstMessageRef &juniorDoMsg)=0 |
| Should update this object's state using the passed-in junior-do-Messsage (that was previously returned by a call to SeniorUpdate() on the senior peer's instance of this object) More...
|
|
virtual String | ToString () const =0 |
| Should return this object's state as a human-readable string. 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...
|
|
A slight specialization of the IDatabaseObject class, just so I can add some application-specific helper methods for my various subclasses to all use.
Definition at line 74 of file MusicData.h.
virtual uint32 CalculateChecksum |
( |
| ) |
const |
|
pure virtualinherited |
This method should be implemented to recalculate the database's current checksum from scratch.
Note that unlike GetCurrentChecksum(), this method should not just returned a precomputed/running checksum, but rather it should grovel over all the data in the database manually. This method will only be called during debugging sessions (e.g. to verify that the running checksum is correct) so it is okay if its implementation is relatively expensive.
Implemented in MusicSheet, NoteAssignmentsMap, and PlaybackState.
Returns a pointer to the ChoirSession object that created this object.
Returns a read-only pointer to the ChoirSession object that created this object.
virtual uint32 GetCurrentChecksum |
( |
| ) |
const |
|
pure virtualinherited |
Should return the current checksum of this object.
This checksum should always correspond exactly to this object's current state, and unless this object is quite small, it should be implemented as a running checksum so that this call can just return a known value rather than recalculating the checksum from the data during this call. That is because this method will be called rather often (e.g. once after any other call that changes this object's state) and therefore it is better if this call can be made as inexpensive as possible.
Implemented in MusicSheet, NoteAssignmentsMap, and PlaybackState.
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.
As above, but returns a const/read-only pointer.
Definition at line 88 of file IDatabaseObject.h.
virtual uint64 GetNetworkTime64 |
( |
| ) |
const |
|
protectedvirtualinherited |
virtual uint64 GetNetworkTime64ForRunTime64 |
( |
uint64 |
runTime64TimeStamp | ) |
const |
|
protectedvirtualinherited |
const Hashtable<ZGPeerID, ConstMessageRef>& GetOnlinePeers |
( |
| ) |
const |
|
protectedinherited |
Returns a table of the currently online peers (and their attributes), or an empty table if we have no ZGDatabasePeerSession.
virtual uint64 GetRunTime64ForNetworkTime64 |
( |
uint64 |
networkTime64TimeStamp | ) |
const |
|
protectedvirtualinherited |
Returns the local time corresponding to a given network time, or 0 if we have no ZGDatabasePeerSession.
- Parameters
-
networkTime64TimeStamp | a network-clock time, in microseconds |
Implements INetworkTimeProvider.
virtual int64 GetToNetworkTimeOffset |
( |
| ) |
const |
|
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.
bool IsPeerOnline |
( |
const ZGPeerID & |
pid | ) |
const |
|
protectedinherited |
Returns true iff the peer with the specified ID is currently on line.
- Parameters
-
pid | The ID of the peer we are interested in. If we have no ZGDatabasePeerSession then this will always return false. |
virtual status_t JuniorUpdate |
( |
const ConstMessageRef & |
juniorDoMsg | ) |
|
|
pure virtualinherited |
Should update this object's state using the passed-in junior-do-Messsage (that was previously returned by a call to SeniorUpdate() on the senior peer's instance of this object)
- Parameters
-
juniorDoMsg | A Message containing instrutions on how to update this object's state. |
- Returns
- B_NO_ERROR on success, or B_ERROR on failure.
Implemented in MusicSheet, NoteAssignmentsMap, and PlaybackState.
virtual status_t SaveToArchive |
( |
const MessageRef & |
archive | ) |
const |
|
pure virtualinherited |
Should be implemented to save this object's entire state into (archive).
- Parameters
-
archive | An empty Message into which to save all of our state information. |
- Returns
- B_NO_ERROR on success, or B_ERROR on failure.
Implemented in MusicSheet, NoteAssignmentsMap, and PlaybackState.
ConstMessageRef SendFullStateToGUI |
( |
bool |
allowReviewTrigger | ) |
|
|
protected |
Saves the state of this object into a Message and sends that Message to the GUI thread.
- Parameters
-
allowReviewTrigger | if true, this method may also trigger a review of the current bell-assignments to see if they need updating. |
- Returns
- a read-only reference to the Message we sent, on success, or a NULL reference on failure.
void SendMessageToGUI |
( |
const ConstMessageRef & |
msg, |
|
|
bool |
allowReviewTrigger |
|
) |
| |
|
protected |
Sends the specified Message to the GUI thread.
- Parameters
-
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 ConstMessageRef SeniorUpdate |
( |
const ConstMessageRef & |
seniorDoMsg | ) |
|
|
pure virtualinherited |
Should update this object's state using the passed-in senior-do-Message (whose semantics are left up to the subclass to define), and then return a reference to a Message that can be used later to update the junior copies of this database to the same final state that this object is now in.
- Parameters
-
seniorDoMsg | a Message containing instructions on how to update this object's state. |
- Returns
- on Success, a reference to a Message that can be used to update the junior peers' instances of this database to the same state that this object is now in, or a NULL reference on failure.
Implemented in MusicSheet, NoteAssignmentsMap, and PlaybackState.
virtual status_t SetFromArchive |
( |
const ConstMessageRef & |
archive | ) |
|
|
pure virtualinherited |
Should be implemented to replace this object's entire state with the state contained in (archive)
- Parameters
-
archive | a Message containing state information, that was previously created by calling SaveToArchive() |
- Returns
- B_NO_ERROR on success, or B_ERROR on failure.
Implemented in MusicSheet, NoteAssignmentsMap, and PlaybackState.
void SetReviewResults |
( |
uint64 |
allNotesUsedChord | ) |
|
|
protected |
Convenience method; calls SetReviewResults(allNotesUsedChord) on our ChoirSession object.
- Parameters
-
allNotesUsedChord | a bit-chord of CHOIR_NOTE_* values indicating which notes are present in our current song. |
virtual void SetToDefaultState |
( |
| ) |
|
|
pure virtualinherited |
virtual String ToString |
( |
| ) |
const |
|
pure virtualinherited |
Should return this object's state as a human-readable string.
This method is only used for debugging purposes (e.g. printing out the state of the database before and after the database is repaired, so the two printouts can be diff'd to see where the error was)
Implemented in PlaybackState, MusicSheet, and NoteAssignmentsMap.
The documentation for this class was generated from the following file: