Aegis  4.25.D505
Public Types | Public Member Functions | Data Fields | Private Member Functions | Private Attributes
project Class Reference

#include <project.h>

Public Types

typedef projectpointer

Public Member Functions

 ~project ()
 project (string_ty *name)
nstring attribute_get (const nstring &name)
bool attribute_get_boolean (const nstring &name)
string_tybaseline_path_get (bool resolve=false)
projectbind_branch (change::pointer bp)
void bind_existing ()
bool bind_existing_errok ()
void bind_keep (const nstring &path)
void bind_new ()
time_t change_completion_timestamp (long change_number)
change::pointer change_get (void)
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 *pp)
void copyright_years_slurp (int *a, int amax, int *alen_p)
bool file_directory_query (const nstring &filename, nstring_list &result_in, nstring_list &result_out, view_path_ty as_view_path)
void file_directory_query (string_ty *filename, struct string_list_ty *result_in, struct string_list_ty *result_out, view_path_ty as_view_path)
bool file_exists (const nstring &filename)
fstate_src_tyfile_find (const nstring &filename, view_path_ty as_view_path)
fstate_src_tyfile_find (string_ty *filename, view_path_ty as_view_path)
fstate_src_tyfile_find (fstate_src_ty *c_src, view_path_ty as_view_path)
fstate_src_tyfile_find (cstate_src_ty *c_src, view_path_ty as_view_path)
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)
projectfind_branch (const char *number)
user_ty::pointer get_user () const
int gid_get ()
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
projectparent_get ()
pstate_typstate_get ()
void pstate_lock_prepare ()
string_typstate_path_get ()
void search_path_get (string_list_ty *result, bool resolve)
void search_path_get (nstring_list &result, bool resolve)
void pstate_write ()
projecttrunk_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 ()
 project (const project &)
projectoperator= (const project &)

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
projectparent
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 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 47 of file project.h.


Member Typedef Documentation

The pointer typedef is provided so that clients of this interface may use change::pointer everywhere they need to point at a change instance, and only this typedef needs to be edited to use a variety of smart pointer instead.

Definition at line 56 of file project.h.


Constructor & Destructor Documentation

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.

The constructor.

Parameters:
nameThe name of the project.
project::project ( ) [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::project ( const project ) [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

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:
nameThe 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::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:
nameThe 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::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:
resolveWhether or not to resolve all of the symlinks in the path.

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

Parameters:
bpThe change corresponding to the project of interest.

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.

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::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:
pathThe directory containing the project.

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.

time_t project::change_completion_timestamp ( long  change_number)

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

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

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.

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 218 of file project.h.

string_ty* project::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_numberThe number of the change for which the path is desired.
Returns:
a string; use str_free when you are done with.
void project::change_reset ( ) [inline]

Definition at line 232 of file project.h.

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.

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.

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::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:
aThe array to store the results in
amaxThe maximum number of distinct years which can be stored in the array (see SIZEOF macro).
alen_pThis is a pointer to the array length used to date.
bool project::file_directory_query ( const nstring filename,
nstring_list result_in,
nstring_list result_out,
view_path_ty  as_view_path 
)

The file_directory_query method is used to determine whether or not a given file name is actually a directory name, and if it is, expand it into a list of files below that directory.

Parameters:
filenameThe name of the file to be checked.
result_inIf the filename is a directory, will be filled with a list of files existing in that directory.
result_outIf the filename is a directory, will be filled with a list of removed files from that directory.
as_view_pathThe view path style to be used.
void project::file_directory_query ( string_ty filename,
struct string_list_ty result_in,
struct string_list_ty result_out,
view_path_ty  as_view_path 
)

The file_directory_query method is used to determine whether or not a given file name is actually a directory name, and if it is, expand it into a list of files below that directory.

Parameters:
filenameThe name of the file to be checked.
result_inIf not NULL, and if the filename is a directory, will be filled with a list of files existing in that directory.
result_outIf not NULL, and if the filename is a directory, will be filled with a list of removed files from that directory.
as_view_pathThe view path style to be used.
bool project::file_exists ( const nstring filename)

The file_exists method is used to determine whether or not a file exists in the project baseline, or any of the ancestor basleines.

Parameters:
filenameThe base-relative name of the file to search for.
fstate_src_ty* project::file_find ( const nstring filename,
view_path_ty  as_view_path 
)

The file_find method is used to find the state information of the named file within the project. It will search the immediate branch, and then any ancestor branches until the file is found.

Parameters:
filenameThe base-relative name of the file to search for.
as_view_pathIf 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::file_find ( string_ty filename,
view_path_ty  as_view_path 
)

The file_find method is used to find the state information of the named file within the project. It will search the immediate branch, and then any ancestor branches until the file is found.

Parameters:
filenameThe base-relative name of the file to search for.
as_view_pathIf 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::file_find ( fstate_src_ty c_src,
view_path_ty  as_view_path 
)

The file_find method is used to find the state information of a file within the project, given the corresponding change file's meta-data. It will search the immediate branch, and then any ancestor branches until the file is found.

Parameters:
c_srcThe change file meta-data for which the corresponding project file is sought.
as_view_pathIf 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::file_find ( cstate_src_ty c_src,
view_path_ty  as_view_path 
)

The file_find method is used to find the state information of a file within the project, given the corresponding change file's meta-data. It will search the immediate branch, and then any ancestor branches until the file is found.

Parameters:
c_srcThe change file meta-data for which the corresponding project file is sought.
as_view_pathIf 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.

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:
uuidThe UUID of the file to search for.
vpIf 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::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:
filenameThe base-relative name of the file to search for.
as_view_pathIf 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::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_pathThe 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.

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

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_nameThe base-relative name of the file to search for.

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:
metaThe meta data, including the name and UUID, of the file to be created.
fstate_src_ty* project::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:
nThe file number to obtain (zero based).
as_view_pathThe style of view path to use when calculating the list.
Returns:
pointer to file mete-data, or NULL if beyond end of list
project* project::find_branch ( const char *  number)

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

Parameters:
numberThe branch number to locate.
Returns:
Pointer to valid project object.
void project::get_the_owner ( ) [private]

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

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

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

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.

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.

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:
dirThe 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::home_path_set ( const nstring dir)

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::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 584 of file project.h.

void project::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:
resultAppend all project branch names to this list.

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::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.

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.
project& project::operator= ( const project ) [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.

long project::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 641 of file project.h.

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 650 of file project.h.

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.

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

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.

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

void project::search_path_get ( string_list_ty result,
bool  resolve 
)

The search_path_get method may be used to obtain the search path (list of progressively more out-of-date ancestor btranches) within which to search for files.

Parameters:
resultWhere to append the additional directories.
resolveWhether or not to expand synbolic links within paths.
void project::search_path_get ( nstring_list result,
bool  resolve 
)

The search_path_get method may be used to obtain the search path (list of progressively more out-of-date ancestor btranches) within which to search for files.

Parameters:
resultWhere to append the additional directories.
resolveWhether or not to expand synbolic links within paths.

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

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

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


Field Documentation

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 781 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 772 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 789 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 821 of file project.h.

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 900 of file project.h.

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 889 of file project.h.

int project::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 867 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 797 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 763 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 805 of file project.h.

bool project::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 835 of file project.h.

long project::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 844 of file project.h.

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

Definition at line 751 of file project.h.

bool project::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 921 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 874 of file project.h.

long project::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 881 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 method, always go via the change_get() method in case it has not been calculated yet.

Definition at line 855 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 829 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 813 of file project.h.

Definition at line 744 of file project.h.

int project::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 861 of file project.h.

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

Definition at line 913 of file project.h.


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