nucm-logo

NUCM-2.0 Documentation
Interface: Query: nc_gettype


[Collection | Query | Attribute]

[nc_list | nc_gettype | nc_version | nc_lastversion | nc_existsversion | nc_isinitiated]

Signature

int  nc_gettype(const char*  path,
                const char*  p_cwd)

Functionality

Determines the type of the NUCM artifact determined by the interpretation of the parameters path and p_cwd.

Return Values

COLLECTION: everything went ok and the artifact is a collection
ATOM : everything went ok and the artifact is an atom
-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
NdbConnect :the server is down or not reachable
NdbComm :a communication error occurred
NdbProtocol:a failure occurred in the NUCM protocol
NdbNotAvail:service is not available

Example

Assuming a repository is filled with projects, and in particular contains a project "my_project" that has members "1", "2", "3", "4", and "5". Furthermore, "my_project" and its members "1", "2", "3", "4", and "5" have been opened in a workspace. The workspace looks as follows:
   /home/bigtime/andre/workspace/my_project/1
					    2
					    3
					    4
					    5
To determine the type of each of the artifacts "1" and "5", the following code fragment can be used:
   #include "nc.h"
   
   int  type;

   type = nc_gettype("my_project/1",
		     "/home/bigtime/andre/workspace");
   if (type == -1) {
      printf("Error obtaining type\n");
   } elseif (type == ATOM) {
      printf("Type is ATOM\n");
   } else {
      printf("Type is COLLECTION\n");
   }
   type = nc_gettype("my_project/5",
		     "/home/bigtime/andre/workspace");
   if (type == -1) {
      printf("Error obtaining type\n");
   } elseif (type == ATOM) {
      printf("Type is ATOM\n");
   } else {
      printf("Type is COLLECTION\n");
   }

[Top | Quick Index] [Concepts | Interface]

SERL <serl.cs.colorado.edu>