#include <LogBookShift.h> class LogBookShift { public: int id() const; const char* name() const; const std::vector<LogBookPerson*>& members() const; void addMember(CSqlite& db, LogBookPerson* person); void removeMember(CSqlite& db, LogBookPerson* person); void setCurrent(CSqlite& db); static LogBookShift* create( CSqlite& db, const char* shiftName, const std::vector<LogBookPerson*>& people ); static LogBookShift* create(CSqlite& db, const char* shiftName); static std::vector<LogBookShift*> list(CSqlite& db); static LogBookShift* find(CSqlite& db, const char* name); static LogBookShift* getCurrent(CSqlite& db); };
... -I$DAQINC -L$DAQLIB -lLogbook -Wl,-rpath=$DAQLIB
This class encapsulates a shift. A shift is a collection of people that work on an experiment together during data taking. Shifts are used to organize work during the highly time critical use of beam-time. At any given time a shift can be on duty or off duty. At most one shift can be on duty. The on-duty shift is referred to in this documentation as the current shift.
This class includes methods that are not intended for general use
but are invoked by LogBook
methods to hide
implementation details from that class. These methods will be
pointed out and are documented in case there's an overlooked use
case that crops up where they may be useful at the application level.
const int id();
Returns the primary key associated with the shift. The primary key is a unique integer assigned to each shift.
const const char* name();
Returns the name of the shift.
const std::vector<LogBookPerson*>& members();
Returns the members of the shift. The result is const reference
to a vector of LogBookPerson
object.
Since you are getting a reference right into LogBookShift
member data you are not allowed to nor should you try to
figure out how to delete these objects.
They will be deleted when the LogBookShift
object is destroyed.
void addMember(CSqlite& db, LogBookPerson* person);
This method is not intended for general use. It adds a new
person
to the shift
represented by this object in the database
open on the Sqlite++ connection object db
.
It is used e.g. by
LogBook::
void removeMember(CSqlite& db, LogBookPerson* person);
This method is not intended for general use. It removes the
member person
from the shift represented
by this object in the database open on the Sqlite++ connection
object referenced by db
void setCurrent(CSqlite& db);
Not intended for general use, makes the shift represented by this
object the current shift. The shift must live in the database
open on the Sqlite++ connection object db
.
static LogBookShift* create(CSqlite& db, const char* shiftName, const std::vector<LogBookPerson*>& people);
Not intended for general use, this method adds the
people in people
to the shift named
shiftName
in the database represented by
the Sqlite++ connection object db
.
The returned value is a pointer to a dynamically allocated
LogBookShift
object which must be
destroyed via delete once it is no longer
needed.
static LogBookShift* create(CSqlite& db, const char* shiftName);
This method is not intended for general use
Creates a new shift named shiftName
with
no members. The shift is created in the database represented
by the Sqlite++ database connection object db
.
The return value is a pointer to a dynamically created
LogBookShift
object that encapsulates
that shift. When that object is no longer needed, you must
destroy it using delete.
static std::vector<LogBookShift*> list(CSqlite& db);
This method is not intended for general use.
Returns a vector of pointers to encapsulations of all the
shifts in the database referenced by the Sqlite++
connection object db
.
The objects pointed to are dynamically allocated and must
be destroyed using delete when they
are no longer needed.
static LogBookShift* find(CSqlite& db, const char* name);
This method is not intended for general use. Returns a pointer
to an encapsulation of the shift named name
in the logbook database referenced by the Sqlite++ database
connection object db
.
If there is no match, nullptr is returned
instead. The result points to a dynamically allocated object.
When your program no longer needs it it should be destroyed
with delete.
static LogBookShift* getCurrent(CSqlite& db);
This method is not intended for general use. If the logbook database referenced by the Sqlite++ database connection object has a current shift, a pointer to an encapsulation of that shift is returned. If not, a nullptr is returned in stead. The returned object is dynamic and, when no longer needed, delete must be used to destroy it.