nebula2学习(3)-nKernelServer类参考
nKernelServer类参考
#i nclude <nkernelserver.h>
Nebula核心服务类
每一个nebula2程序都有且只有一个 核心服务类对象,执行时间贯穿整个程序运行期。
Public Member Functions
公用成员函数
nKernelServer ()
构造函数
~nKernelServer ()
析构函数
Member Function Documentation
成员函数文档
nKernelServer * nKernelServer::Instance ( ) [inline, static]
return pointer to single kernel server instance
返回指向核心服务器实例的指针,也就是ks,也就是this.
void nKernelServer::Lock ( ) [inline]
take the kernel lock (to make the kernel multithreading safe)
锁定核心(保证核心在多线程下的安全)
void nKernelServer::Unlock ( ) [inline]
release the kernel lock
解锁
void nKernelServer::AddClass ( const char * superClassName,
nClass * cl
)
add a class object to the kernel
增加一个类对象给核心
Parameters:
参数
superClassName name of super class 超类的名称
cl class object to add 增加的对象指针
void nKernelServer::RemClass ( nClass * cl )
close and remove a class from the kernel
从核心中关闭并删除一个类
Parameters:
cl Pointer to class to be removed 指向被删除类的指针
nClass * nKernelServer::CreateClass ( const char * className )
Create a class object by name, this increments the refcount of the class object.
根据名字建立一个类对象,这会增加类对象的引用数
void nKernelServer::ReleaseClass ( nClass * cl )
Decrement the ref count of a given class. Currently, the class object will not be unloaded when it's refcount reaches 0.
减少给定类的引用数。当他的引用数到0时,不会被卸载。
cl pointer to class object 指向类对象的指针
nClass * nKernelServer::FindClass ( const char * className )
Return pointer to class object defined by className. If the class is not loaded, 0 is returned
通过类名查找一个类的对象,返回其指针,如果类没有加载,返回0
className Name of the class 类的名字
const nHashList* nKernelServer::GetClassList ( ) const
return the list of classes
返回类列表
nRoot * nKernelServer::New ( const char * className, const char * path )
Create a Nebula object given a class name and a path in the Nebula object hierarchy. This method will abort the Nebula app with a fatal error if the object couldn't be created.
给定类名和nebula对象继承路径,建立一个nebula对象。如果不能建立,将停止nebula程序的运行。
className Name of the object 对象名
path Path where to create the new object in the hierarchy 路径
nObject * nKernelServer::New ( const char * className )
Create a Nebula object given a class name. This method will abort the Nebula app with a fatal error if the object couldn't be created.
给定类名,建立一个nebula对象。如果不能建立,将停止nebula程序的运行。
nRoot * nKernelServer::NewNoFail ( const char * className, const char * path )
Same as nKernelServer::New(), but doesn't fail if the object can't be created, instead, a 0 pointer is returned.
和new一样,但是如果不成功,返回0
nObject * nKernelServer::Load ( const char * path )
create a Nebula object from a persistent object file
从文件建立一个nebula对象
nRoot * nKernelServer::LoadAs ( const char * path, const char * objName )
create a Nebula object from a persistent object file with given name
指定对象名字
nRoot * nKernelServer::Lookup ( const char * path )
Lookup an object by the given path and return a pointer to it. Check whether object described by path exists, returns pointer or NULL.
在继承中寻找一个nebula对象
void nKernelServer::SetCwd ( nRoot * o )
Set the current working object.
设置当前工作对象
nRoot * nKernelServer::GetCwd ( )
得到当前工作对象
void nKernelServer::PushCwd ( nRoot * o )
Push current working object on a stack, and set new current working object.
把当前工作对象push进堆栈
nRoot * nKernelServer::PopCwd ( )
Pop working object from stack, and set as new working object. Return previous working object.
从堆栈中pop出对象
void nKernelServer::SetLogHandler ( nLogHandler * logHandler )
Set new log handler. NOTE: the nKernelServer does not gain ownership of the log handler, it just uses it. Whoever sets a log handler is responsible to cleanly release it, and must make sure that the kernel server is not left with an invalid pointer by set a zero log handler.
设置一个新的日志句柄
nLogHandler * nKernelServer::GetLogHandler ( ) const
Get pointer to current log handler object. This method can be used to obtain a pointer to the log line buffer object of the log handler. Please note that support for a line buffer is optional!
得到日志句柄
void nKernelServer::Print ( const char * str, ... )
Print a new text message to the log. This always works like a normal printf, it will never halt the program for user interaction.
打印一个日志信息,不会停止程序等待用户交互
void nKernelServer::Message ( const char * str, ... )
Show an important message which may require user interaction. The actual behaviour of this method depends on the actual log handler class (under Win32, a message box could be shown to the user).
显示一个重要的用户消息,可能要求用户响应
void nKernelServer::Error ( const char * str, ... )
Show an error message which may require user interaction. The actual behaviour of this method depends on the actual log handler class (under Win32, a message box could be shown to the user).
显示一个错误消息
void nKernelServer::ReplaceFileServer ( const char * className )
Set an alternative file server. Release the previous file server.
设置一个替代的文件服务器,释放从前的。
void nKernelServer::AddPackage ( void(*)() _func )
Add an extension class package to the kernel. The provided function should call nKernelServer::AddModule() for each class in the package.
增加一个扩展类包给内核
void nKernelServer::AddModule ( const char * name,
bool(*)(nClass *, nKernelServer *) _init_func,
void *(*)(void) _new_func
)
增加一个代码模块给内核
nHardRefServer * nKernelServer::GetHardRefServer ( ) const [inline]
得到指向硬参考服务器?的指针
nPersistServer * nKernelServer::GetPersistServer ( ) const [inline]
get pointer to file server
得到指向文件服务器的指针
nRemoteServer * nKernelServer::GetRemoteServer ( ) const [inline]
get pointer to remote server
得到指向远程服务器的指针
nTimeServer * nKernelServer::GetTimeServer ( ) const [inline]
get pointer to time server
得到指向时间服务器的指针
void nKernelServer::Trigger ( void )
Update mem status variables from mem manager.
更新内存使用变量
- 上一篇:启用新的Blog!
- 下一篇:今天建立我的Blog!