project_ty Class Reference

#include <project.h>


Public Member Functions

 ~project_ty ()
 project_ty (string_ty *name)
nstring attribute_get (const nstring &name)
bool attribute_get_boolean (const nstring &name)
string_tybaseline_path_get (bool resolve=false)
project_tybind_branch (change::pointer bp)
void bind_existing ()
bool bind_existing_errok ()
void bind_keep (const nstring &path)
void bind_new ()
change::pointer change_get ()
change::pointer change_get_raw ()
string_tychange_path_get (long change_number)
void change_reset ()
string_tychanges_path_get ()
void convert_to_new_format ()
void copy_the_owner (project_ty *pp)
void copyright_years_slurp (int *a, int amax, int *alen_p)
fstate_src_tyfile_find_by_uuid (string_ty *uuid, view_path_ty vp)
fstate_src_tyfile_find_fuzzy (string_ty *filename, view_path_ty as_view_path)
void file_list_invalidate ()
fstate_src_tyfile_new (string_ty *file_name)
fstate_src_tyfile_new (fstate_src_ty *meta)
fstate_src_tyfile_nth (size_t n, view_path_ty as_view_path)
project_tyfind_branch (const char *number)
user_ty::pointer get_user () const
int gid_get ()
time_t change_completion_timestamp (long change_number)
string_tyhistory_path_get ()
string_tyhome_path_get ()
void home_path_set (string_ty *dir)
void home_path_set (const nstring &dir)
string_tyinfo_path_get ()
bool is_a_trunk () const
void list_inner (string_list_ty &result)
void lock_prepare_everything ()
string_tyname_get () const
long parent_branch_number_get () const
project_typarent_get ()
pstate_typstate_get ()
void pstate_lock_prepare ()
string_typstate_path_get ()
void pstate_write ()
project_tytrunk_get ()
int uid_get ()
int umask_get ()

Data Fields

long reference_count

Private Member Functions

struct string_list_tyfile_list_get (view_path_ty as_view_path)
void get_the_owner ()
void lock_sync ()
 project_ty ()
 project_ty (const project_ty &)
project_tyoperator= (const project_ty &)

Private Attributes

string_tyname
string_tyhome_path
string_tybaseline_path_unresolved
string_tybaseline_path
itab_tychange2time_stp
string_tyhistory_path
string_tyinfo_path
string_typstate_path
string_tychanges_path
pstate_typstate_data
bool is_a_new_file
long lock_magic
change::pointer pcp
int uid
int gid
project_typarent
long parent_bn
struct string_list_tyfile_list [view_path_MAX]
struct symtab_tyfile_by_uuid [view_path_MAX]
user_ty::pointer up
bool off_limits


Detailed Description

The project_ty class is used to remember the state of a project.

Eventually, it will be discouraged to use this class directly. The preferred method will be to access it via a project class (see below) smart pointer. This will be able to guarantee the reference counting semantics.

This class is presently in transition from being a C struct. One by one the access functions will be turned into access methids, and the instance variables will become private.

Definition at line 48 of file project.h.


Constructor & Destructor Documentation

project_ty::~project_ty (  ) 

The destructor.

It is not virtual; thou shalt not derive fron this class.

Note:
Eventually this method will be private, to ensure the reference counting always works. The correct method is to call the project_free function.

project_ty::project_ty ( string_ty name  ) 

The constructor.

Parameters:
name The name of the project.

project_ty::project_ty (  )  [private]

The default constructor.

Do not use this method. It is not defined. Projects will always have a name, it it shall always be supplied to the constructor.

project_ty::project_ty ( const project_ty  )  [private]

The copy constructor. Do not use.

The prefereed mechanism is to use the reference counting provided the the project class (see below) smart pointer.


Member Function Documentation

nstring project_ty::attribute_get ( const nstring name  ) 

The attribute_get method is used to obtain the value of an attribute of this project.

The project attributes are kept in the project_specific field of the project config file (aegis.conf) which is a project source file. Only use this method when you want the baseline attributes, use change::pconf_attributes_find within a change set.

Parameters:
name The name of the attribute. Attribute names are not case sensitive.
Returns:
the string value of the attribute, or the empty string if not found.

bool project_ty::attribute_get_boolean ( const nstring name  ) 

The attribute_get_boolean method is used to obtain the value of an attribute of this project, as a true/false value.

The project attributes are kept in the project_specific field of the project config file (aegis.conf) which is a project source file. Only use this method when you want the baseline attributes, use change::pconf_attributes_find_boolean within a change set.

Parameters:
name The name of the attribute. Attribute names are not case sensitive.
Returns:
the boolean value of the attribute, or false if the attribute is not found or is not interpretable as a boolean.

string_ty* project_ty::baseline_path_get ( bool  resolve = false  ) 

The baseline_path_get method is used to obtain the absolure path of the project's (branch's) baseline.

Parameters:
resolve Whether or not to resolve all of the symlinks in the path.

project_ty* project_ty::bind_branch ( change::pointer  bp  ) 

The bind_branch method is used to bind a branch of this project into a new project object.

Parameters:
bp The change corresponding to the project of interest.

void project_ty::bind_existing (  ) 

The bind_existing method is used to bind a newly created project object to an existing project.

Note:
This method does not return if there is an error. A fatal error message will be produced in this case.

bool project_ty::bind_existing_errok (  ) 

The bind_existing_errok method is used to bind a newly created project object to an existing project.

Returns:
bool; true if bound successfully, false if not

void project_ty::bind_keep ( const nstring path  ) 

The bind_keep method is used to bind a new project to an existing directory, as needed by the "aenpr -keep" option.

Parameters:
path The directory containing the project.

void project_ty::bind_new (  ) 

The bind_new method is used to bind a new project object to a new name. This will create all of the necessary data structures and (eventually) files, once the project directory has been set.

change::pointer project_ty::change_get (  ) 

The change_get method is used to obtain a pointer to the change object representing this project branch.

Returns:
pointer to change object; DO NOT change_free() or delete it.

change::pointer project_ty::change_get_raw (  )  [inline]

The change_get_raw method is used to obtain a pointer to the change object representing this project branch or NULL if no such object is in the project.

Returns:
pointer to change object; DO NOT change_free() or delete it.

Definition at line 187 of file project.h.

string_ty* project_ty::change_path_get ( long  change_number  ) 

The change_path_get method is used to obtain the absolute path of the meta-data of a specific change set.

Parameters:
change_number The number of the change for which the path is desired.
Returns:
a string; use str_free when you are done with.

void project_ty::change_reset (  )  [inline]

Definition at line 201 of file project.h.

string_ty* project_ty::changes_path_get (  ) 

The changes_path_get method is used to obtain the absolute path of the directory containing change set meta-data.

Returns:
a string; do not str_free or delete it, because it is cached.

void project_ty::convert_to_new_format (  ) 

The convert_to_new_format method is used to convert Aegis 2.3 project meta-data into Aegis 3.0 (and later) project meta-data.

void project_ty::copy_the_owner ( project_ty pp  ) 

The copy_the_owner method is used to copy the owner from another project. It is only ever used by aenrls, which sort-of clones another project. Don't use this method.

Note: this is only a transient requirement for new projects. Existing projects take their uid and gid from the Unix uid and gid of the project directory.

void project_ty::copyright_years_slurp ( int *  a,
int  amax,
int *  alen_p 
)

the copyright_years_slurp method is used to determine the range of copyright years covered by this project and all its ancrestor projects back to the trunk.

Parameters:
a The array to store the results in
amax The maximum number of distinct years which can be stored in the array (see SIZEOF macro). This is a pointer to the array length used to date.

fstate_src_ty* project_ty::file_find_by_uuid ( string_ty uuid,
view_path_ty  vp 
)

The file_find_by_uuid method is used to find the state information of a file within the project, given the file's UUID. It will search the immediate branch, and then any ancestor branches until the file is found.

Parameters:
uuid The UUID of the file to search for.
vp If this is true, apply viewpath rules to the file (i.e. if it is removed, return a null pointer) if false return first instance found.

fstate_src_ty* project_ty::file_find_fuzzy ( string_ty filename,
view_path_ty  as_view_path 
)

The file_find_fuzzy method is used to find the state information for a project file when the project_file_find function fails. It uses fuzzy string matching, which is significantly slower than exact searching, but can provide very useful error messages for users.

Parameters:
pp The project to search.
filename The base-relative name of the file to search for.
as_view_path If this is true, apply viewpath rules to the file (i.e. if it is removed, return a null pointer) if false return first instance found.

struct string_list_ty* project_ty::file_list_get ( view_path_ty  as_view_path  )  [read, private]

The file_list_get method is used to obtain a list of file names. The lists are calculated on demand and cached.

Parameters:
as_view_path The view path style to use when calculating the list of project files.
Returns:
Pointer to a string list, do not delete it, it is cached.

void project_ty::file_list_invalidate (  ) 

The file_list_invalidate method is used to clear the cahced project file information when it becomes stale.

fstate_src_ty* project_ty::file_new ( string_ty file_name  ) 

The file_new method is used to create a new project file by name, and add it to the project file manifest. No validation is done, the called must guarantee that the file name is unique.

Parameters:
file_name The base-relative name of the file to search for.

fstate_src_ty* project_ty::file_new ( fstate_src_ty meta  ) 

The file_new method is used to create a new project file from the meta data of an existing (usually change set) file, and add it to the project file manifest. No validation is done, the caller must guarantee that the file name and UUID are unique.

Parameters:
meta The meta data, including the name and UUID, of the file to be created.

fstate_src_ty* project_ty::file_nth ( size_t  n,
view_path_ty  as_view_path 
)

The file_nth method is used to get the 'n'th file from the list of project files.

Parameters:
n The file number to obtain (zero based).
as_view_path The style of view path to use when calculating the list.
Returns:
pointer to file mete-data, or NULL if beyond end of list

project_ty* project_ty::find_branch ( const char *  number  ) 

The find_branch method is used to locate the branch with the given number in this project.

Parameters:
number The branch number to locate.
Returns:
Pointer to valid project object.

void project_ty::get_the_owner (  )  [private]

The get_the_owner method is used to determine the Unix pid and gid for the project.

user_ty::pointer project_ty::get_user (  )  const

The get_user method may be used to obtain a pointer to the user (and group) ownership date for this project.

int project_ty::gid_get (  ) 

The gid_get method is used to obtain the Unix group id of the project owner.

time_t project_ty::change_completion_timestamp ( long  change_number  ) 

The change_completion_timestamp is used to determine the completion timestamp of a change.

Parameters:
change_number the number of the change.
Returns:
the completion timestamp of the change.
Note:
this method caches its results for speed.

string_ty* project_ty::history_path_get (  ) 

The history_path_get method is used to determine the top-level directory of the tree which is used to hold the project's history files.

Returns:
a pointer to a string. Do NOT free this string when you are done with it, because it is cached.

string_ty* project_ty::home_path_get (  ) 

The home_path_get method is used to get the "home" directory of a project; the directory which contains trunk's delta directories and the baseline, and the "info" meta-data directory.

Returns:
a string containing the absolute path. DO NOT str_free or delete it.
Note:
It is a bug to call this method for anything other than a trunk project. Calling if for a branch will result in an assert failure.

void project_ty::home_path_set ( string_ty dir  ) 

The home_path_set method is used when creating a new project to remeber the directory the project beaselines and meta-data are stored within.

Parameters:
dir The absolute path of the directory in which to keep the project. To cope with automounters, directories are stored as given, or are derived from the home directory in the passwd file. Within Aegis, pathnames have their symbolic links resolved, and any comparison of paths is done on this "system idea" of the pathname.

void project_ty::home_path_set ( const nstring dir  ) 

string_ty* project_ty::info_path_get (  ) 

The info_path_get method is used to obtain the absolute path of the meta-data file for this project (branch).

Returns:
a string; do not str_free or delete it, because it is cached.
Note:
it is a bug to call this for anything but a top-level (trunk) project.

bool project_ty::is_a_trunk (  )  const [inline]

The is_a_trunk method is used to determine whether a project is a trunk branch (is the deepest ancestor) or a normal nested branch (has at least one ancestor branch).

Returns:
bool; true if is a trunk, false if is a branch

Definition at line 450 of file project.h.

void project_ty::list_inner ( string_list_ty result  ) 

The list_inner method is used to append the branch names to the result list. This is one step of building a complete list of projects.

Parameters:
result Append all project branch names to this list.

void project_ty::lock_prepare_everything (  ) 

The lock_prepare_everything method is used to take a resd-only lock of everything in the project: pstate, baseline, changes, and recurse into all active branches.

void project_ty::lock_sync (  )  [private]

The lock_sync method is used to invalidate the project state data if the lock has been released and taken again.

Note:
it is a bug to call this for anything but a top-level (trunk) project.

string_ty* project_ty::name_get (  )  const

The name_get method is used to get the name of the project.

Returns:
a string; the name of the project. DO NOT str_free it.

long project_ty::parent_branch_number_get (  )  const [inline]

The parent_branch_number_get method is used to get the branch (change) number of this branch in the parent branch.

Note:
This method is not meaningful for trunk projects (branches).

Definition at line 497 of file project.h.

project_ty* project_ty::parent_get (  )  [inline]

The parent_get method is used to obtain the parent brach of this project.

Returns:
pointer to project; do not delete or project_free

Definition at line 506 of file project.h.

pstate_ty* project_ty::pstate_get (  ) 

The pstate_get method is used to obtain the project state data.

Returns:
pointer to pstate_ty data; do not delete, it is cached.
Note:
it is a bug to call this for anything but a top-level (trunk) project.

void project_ty::pstate_lock_prepare (  ) 

The pstate_lock_prepare method is used to prepare to take a project pstate lock for this project, prior to lock_take() being called.

string_ty* project_ty::pstate_path_get (  ) 

The pstate_path_get method is used to obtain the absolute path of the pstate (project state) file.

Returns:
a string; do not str_free or delete it, because it is cached.
Note:
it is a bug to call this for anything but a top-level (trunk) project.

void project_ty::pstate_write (  ) 

The pstate_write method is used to write out the project state data into the meta-data directory tree.

project_ty* project_ty::trunk_get (  ) 

The trunk_get method is used to find the trunk project of this project, then top-level branch of this project.

int project_ty::uid_get (  ) 

The uid_get method is used to obtain the Unix user id of the project owner.

int project_ty::umask_get (  ) 

The umask_get method is used to obtain the file creation mode mask for this project.

project_ty& project_ty::operator= ( const project_ty  )  [private]

The assignment operator. Do not use.

The prefereed mechanism is to use the reference counting provided the the project class (see below) smart pointer.


Field Documentation

Definition at line 563 of file project.h.

The name instance variable is used to remember the name of this project.

Definition at line 570 of file project.h.

The home_path instance variable is used to remember the "home" directory of a project; the directory which contains trunk's delta directories and the baseline, and the "info" meta-data directory.

Note:
Never access this instance variable directly, always go via home_path_get() in case it hasn't been calculated yet.

Definition at line 582 of file project.h.

The baseline_path_unresolved instance variable is used to remember the absolute path of this project's (branch's) baseline directory. It has not had is symbolic links resolved. All access is via the baseline_path_get method, which takes care of calculating it on demand.

Definition at line 591 of file project.h.

The baseline_path_unresolved instance variable is used to remember the absolute path of this project's (branch's) baseline directory. It has not had is symbolic links resolved. All access is via the baseline_path_get method, which takes care of calculating it on demand.

Definition at line 600 of file project.h.

The change2time_stp instance variable is used to remember for each change the completion timestamp. All access are via the change_completion_timestamp_maybe_cached method, which take care of calculating it on demand.

Definition at line 608 of file project.h.

The history_path is used to remember the absolute path of the distory directory. The calculation is deferred until needed. Always use the history_path_get method, never access this instance variable directly.

Definition at line 616 of file project.h.

The info_path instance variable is used to remember the location of the meta-data file for this project (branch). Never access the info_path variable directly, always go via the info_path_get method.

Definition at line 624 of file project.h.

The pstate_path instance variable is used to remember the absolute path of the pstate (project state) file. It is calculated as needed. Never access this instance variable directly, always go via the pstate_path_get method.

Definition at line 632 of file project.h.

The changes_path instance variable is used to remember the absolute path of the directory containing change set meta-data. It is calculated as needed. Never access this instance variable directly, always go via the changes_path_get method.

Definition at line 640 of file project.h.

The pstate_data instance variable is used to remember the project state data. It is calculated as needed. Never access this instance variable directly, always go via the pstate_get method.

Definition at line 648 of file project.h.

bool project_ty::is_a_new_file [private]

The is_a_new_file instance variable is used to remember whether the pstate file is a new file which has to be created.

Definition at line 654 of file project.h.

long project_ty::lock_magic [private]

The lock_magic instance variable is used to remember the last time the lock was taken. If the lock_sync function returns different, it means we have to invalidate all our project data and read it in again, because something could have changed. Only every accessed by the lock_sync ethod.

Definition at line 663 of file project.h.

The pcp instance variable is used to remember the change object representing this branch's state.

Note:
Never access this instance variable directly, event from a project_ty method, always go via the change_get() method in case it has not been calculated yet.

Definition at line 674 of file project.h.

int project_ty::uid [private]

The uid instance variable is used to remember the Unix user id for the project owner. This is set by the get_the_owner method.

Definition at line 680 of file project.h.

int project_ty::gid [private]

The gid instance variable is used to remember the Unix group id for the project owner. This is set by the get_the_owner method.

Definition at line 686 of file project.h.

The parent instance variable is used to remember the project which this project is a branch of. If it is NULL, then this is a trunk project.

Definition at line 693 of file project.h.

long project_ty::parent_bn [private]

The parent_bn instance variable is used to remember the change (branch) number of this project relative to the parent branch. If it is TRUNK_BRANCH_NUMER, then this is a trunk project.

Definition at line 700 of file project.h.

struct string_list_ty* project_ty::file_list[view_path_MAX] [read, private]

The file_list instance variable is used to remember the list of files in the project, one list for each style of view path. Never access this instance variable directly, always go via the file_list_get method, they are calculated on demand.

Definition at line 708 of file project.h.

struct symtab_ty* project_ty::file_by_uuid[view_path_MAX] [read, private]

The file_by_uuid instance variable is used to remember a symbol table of files indexed by UUID (or by file name if your project has any files without a UUID for backwards compatibility).

This instance variable shall always be accessed via the find_file_by_uuid method. The tables are calculated on demand and cached.

Definition at line 719 of file project.h.

The up instance variable is used to remember the user (and group) which owns this project.

Definition at line 733 of file project.h.

bool project_ty::off_limits [private]

The off_limits instance variable is used to remember when a project is inaccessable to the executing user. This flag is normally false, but it will be set to true by project::bind_existing for projects which are inaccessable.

Definition at line 741 of file project.h.


The documentation for this class was generated from the following file:

Generated on Wed Mar 12 23:37:41 2008 for Aegis by  doxygen 1.5.5