2.2.4.38.15 Project::FindClass

Description

Find an object of a registered type class [in the specified file and compile and link it as needed] [and can optionally compile and link dependent file] Consecutive calls made to FindClass returns a reference to the same object

Syntax

ClassObject FindClass( LPCSTR lpcszName, LPCSTR lpcszPath = NULL, BOOL bCompileDependents = TRUE )

Parameters

lpcszName
[input]Name of the registered class type
lpcszPath
[input]Optional input of file path, if NULL no files are loaded
bCompileDependents
[input]Optional input causes dependent files (intelligently composed from include directives in the main .c[pp] file)
to be compiled and linked

Return

Returns a ClassObject if successfull (can use NULL comparison) can be casted to a refrence to the desired type.

Examples

EX1

void Project_FindClass_Ex1()
{
    string strFilename = GetAppPath(true) + "OriginC\\Originlab\\FitNL.cpp";
    
    OperationBase& op = (OperationBase&) Project.CreateClass("FitNL", strFilename);
    
    if(op == NULL) 
    {
    	printf("Create class failed");
    	return;
    }
    
    OperationBase& op2 = (OperationBase&) Project.FindClass("FitNL",strFilename);
    
    if( NULL == op)
        printf("Fail to find class object of FitNL");
    else printf("find class object of FitNL successfully");
    
}

Remark

See Also

Project::CreateClass, Project::FindFunction

Header to Include

origin.h