nucm-logo

NUCM-2.0 Documentation
Interface: Access: nc_close


[Miscellaneous | Access | Versioning]

[nc_open | nc_close]

Signature

int  nc_close(const char*  target,
              const char*  t_cwd,
              int  forced)

Functionality

Relinquishes access to an artifact. The artifact is removed from the workspace. If the artifact is a collection, all members of the collection are removed as well. If the artifact is a collection and itself or one or more of its members is initiated, the close does not succeed unless the close is forced. A close is forced if the value of the parameter forced is 1, a close is not forced if the value of the parameter forced is 0.

Return Values

0: everything went ok
-1: an error occurred

NdbErrno Codes

NdbOk :everything went ok
NdbUnknown:the path does not represent a NUCM artifact
NdbNotOpen:the NUCM artifact has not been opened in the workspace
NdbInitiated: the artifact is a collection and itself or one or more of its members is initiated and the close is not forced

Example

Assuming a workspace has been opened that contains a project "my_project" and its members "1", "2", "3", "4", "5". Assume furthermore artifact "1" has been initiated. The workspace looks as follows:
   /home/bigtime/andre/workspace/my_project/1
					    2
					    3
					    4
					    5
This workspace can be closed as follows:
   #include "nc.h"

   nc_close("/home/bigtime/andre/workspace/my_project/1",
	    "",
	    1);
   nc_close("/home/bigtime/andre/workspace/my_project",
	    "",
	    0);
The first call to nc_close forces artifact "1" to be closed even though it has been initiated. The second call to nc_close closes all the artifacts within my_project as well. The resulting workspace contents is as follows:
   /home/bigtime/andre/workspace
Of course, a single call
   #include "nc.h"

   nc_close("/home/bigtime/andre/workspace/my_project",
	    "",
	    1);
would have had the same effect as the above two calls, but would have also closed other artifacts that could have been initiated, whereas the separation in two calls will generate an error if another artifact was initiated.

[Top | Quick Index] [Concepts | Interface]

SERL <serl.cs.colorado.edu>