OpenBlox
A game engine which provides a simple and easy to learn Lua API.
OB::Instance::DataModel Class Reference

#include <DataModel.h>

Inheritance diagram for OB::Instance::DataModel:
OB::Instance::ServiceProvider OB::Instance::Instance

Public Member Functions

 DataModel (OBEngine *eng)
 
virtual ~DataModel ()
 
void Shutdown (int statusCode=0)
 
void initServices ()
 
bool getRobloxCompatMode ()
 
void setRobloxCompatMode (bool robloxCompatMode)
 
shared_ptr< WorkspacegetWorkspace ()
 
shared_ptr< CoreGuigetCoreGui ()
 
shared_ptr< LightinggetLighting ()
 
shared_ptr< PlayersgetPlayers ()
 
shared_ptr< ContentProvidergetContentProvider ()
 
shared_ptr< LogServicegetLogService ()
 
shared_ptr< RunServicegetRunService ()
 
shared_ptr< UserInputServicegetUserInputService ()
 
virtual shared_ptr< InstanceGetService (std::string className)
 
weak_ptr< InstancelookupInstance (ob_uint64 netId)
 
void putInstance (shared_ptr< Instance > inst)
 
void dropInstance (ob_uint64 reqNetId)
 
ob_uint64 nextNetworkID ()
 
virtual void replicateProperties (shared_ptr< NetworkReplicator > peer)
 
virtual void replicateChildren (shared_ptr< NetworkReplicator > peer)
 
virtual void deserialize (pugi::xml_node thisNode)
 
virtual std::string fixedSerializedID ()
 
virtual std::map< std::string, _PropertyInfogetProperties ()
 
virtual shared_ptr< Type::VarWrappergetProperty (std::string prop)
 
virtual void setProperty (std::string prop, shared_ptr< Type::VarWrapper > val)
 
virtual void preRender ()
 
virtual void render ()
 
 DECLARE_LUA_METHOD (Shutdown)
 
 DECLARE_LUA_METHOD (getRobloxCompatMode)
 
 DECLARE_LUA_METHOD (setRobloxCompatMode)
 
 DECLARE_CLASS (DataModel)
 
- Public Member Functions inherited from OB::Instance::ServiceProvider
 ServiceProvider (OBEngine *eng)
 
virtual ~ServiceProvider ()
 
virtual shared_ptr< InstanceFindService (std::string className)
 
 DECLARE_LUA_METHOD (FindService)
 
 DECLARE_LUA_METHOD (GetService)
 
 DECLARE_CLASS (ServiceProvider)
 
- Public Member Functions inherited from OB::Instance::Instance
 Instance (OBEngine *eng)
 
virtual ~Instance ()
 
virtual void setName (std::string name)
 
virtual std::string getName ()
 
virtual void setArchivable (bool archivable)
 
virtual bool getArchivable ()
 
OBEnginegetEngine ()
 
virtual void ClearAllChildren ()
 
virtual shared_ptr< InstanceClone ()
 
virtual void Destroy ()
 
virtual void Remove ()
 
virtual shared_ptr< InstanceFindFirstAncestor (std::string name)
 
virtual shared_ptr< InstanceFindFirstAncestorOfClass (std::string className)
 
virtual shared_ptr< InstanceFindFirstAncestorWhichIsA (std::string className)
 
virtual shared_ptr< InstanceFindFirstChild (std::string name, bool recursive=false)
 
virtual shared_ptr< InstanceFindFirstChildOfClass (std::string className, bool recursive=false)
 
virtual shared_ptr< InstanceFindFirstChildWhichIsA (std::string className, bool recursive=false)
 
virtual std::vector< shared_ptr< Instance > > GetChildren ()
 
virtual std::string GetFullName ()
 
virtual bool IsA (std::string name)
 
virtual bool IsAncestorOf (shared_ptr< Instance > descendant)
 
virtual bool IsDescendantOf (shared_ptr< Instance > ancestor)
 
ob_int64 GetNetworkID ()
 
void setNetworkID (ob_int64 netId)
 
void generateNetworkID ()
 
virtual void replicate (shared_ptr< NetworkReplicator > peer)
 
virtual void serializeThis (pugi::xml_node parentNode, shared_ptr< Instance > model)
 
virtual void serialize (pugi::xml_node parentNode, shared_ptr< Instance > model)
 
virtual void serializeChildren (pugi::xml_node parentNode, shared_ptr< Instance > model)
 
virtual void serializeProperties (pugi::xml_node thisNode, shared_ptr< Instance > model)
 
virtual void deserializeCreate (pugi::xml_node thisNode)
 
virtual void deserializeProperties (pugi::xml_node thisNode)
 
virtual std::string serializedID ()
 
virtual void tick ()
 
virtual void tickChildren ()
 
virtual std::string toString ()
 
virtual void setParent (shared_ptr< Instance > parent, bool useDMNotify)
 
virtual void removeChild (shared_ptr< Instance > kid)
 
virtual void addChild (shared_ptr< Instance > kid)
 
shared_ptr< InstancegetParent ()
 
int wrap_lua (lua_State *L)
 
virtual bool assetLoaded (std::string res)
 
virtual shared_ptr< InstancecloneImpl ()
 
virtual std::string getClassName ()
 
virtual std::string getLuaClassName ()
 

Static Public Member Functions

static void register_lua_property_getters (lua_State *L)
 
static void register_lua_property_setters (lua_State *L)
 
static void register_lua_methods (lua_State *L)
 
- Static Public Member Functions inherited from OB::Instance::ServiceProvider
static void register_lua_methods (lua_State *L)
 
- Static Public Member Functions inherited from OB::Instance::Instance
static void registerLuaClass (OBEngine *eng, std::string className, luaRegisterFunc register_metamethods, luaRegisterFunc register_methods, luaRegisterFunc register_getters, luaRegisterFunc register_setters, luaRegisterFunc register_events)
 
static shared_ptr< InstancecheckInstance (lua_State *L, int index, bool errIfNot=true, bool allowNil=true)
 
static int lua_index (lua_State *L)
 
static int lua_newindex (lua_State *L)
 
static int lua_eq (lua_State *L)
 
static int lua_gc (lua_State *L)
 
static int lua_toString (lua_State *L)
 
static int lua_getClassName (lua_State *L)
 
static int lua_getUseCount (lua_State *L)
 
static int lua_getName (lua_State *L)
 
static int lua_setName (lua_State *L)
 
static int lua_getParent (lua_State *L)
 
static int lua_setParent (lua_State *L)
 
static int lua_getArchivable (lua_State *L)
 
static int lua_setArchivable (lua_State *L)
 
static int lua_readOnlyProperty (lua_State *L)
 
static int lua_ClearAllChildren (lua_State *L)
 
static int lua_Clone (lua_State *L)
 
static int lua_Destroy (lua_State *L)
 
static int lua_Remove (lua_State *L)
 
static int lua_FindFirstAncestor (lua_State *L)
 
static int lua_FindFirstAncestorOfClass (lua_State *L)
 
static int lua_FindFirstAncestorWhichIsA (lua_State *L)
 
static int lua_FindFirstChild (lua_State *L)
 
static int lua_FindFirstChildOfClass (lua_State *L)
 
static int lua_FindFirstChildWhichIsA (lua_State *L)
 
static int lua_GetChildren (lua_State *L)
 
static int lua_GetFullName (lua_State *L)
 
static int lua_IsA (lua_State *L)
 
static int lua_IsAncestorOf (lua_State *L)
 
static int lua_IsDescendantOf (lua_State *L)
 
static int lua_GetNetworkID (lua_State *L)
 
static void register_lua_metamethods (lua_State *L)
 
static void register_lua_methods (lua_State *L)
 
static void register_lua_property_setters (lua_State *L)
 
static void register_lua_property_getters (lua_State *L)
 
static void register_lua_events (lua_State *L)
 
static void registerClass ()
 
static void _ob_init (OBEngine *eng)
 

Public Attributes

shared_ptr< Workspaceworkspace
 
shared_ptr< CoreGuicoreGui
 
shared_ptr< Lightinglighting
 
shared_ptr< Playersplayers
 
shared_ptr< ContentProvidercontentProvider
 
shared_ptr< LogServicelogService
 
shared_ptr< RunServicerunService
 
shared_ptr< ReplicatedFirstreplicatedFirst
 
shared_ptr< UserInputServiceuserInputService
 
bool RobloxCompatMode
 
ob_uint64 netIdStartIdx
 
ob_uint64 netIdNextIdx
 
std::map< ob_uint64, weak_ptr< Instance > > instMap
 
std::vector< ob_uint64freedNetIDs
 
- Public Attributes inherited from OB::Instance::Instance
bool ParentLocked
 
shared_ptr< Type::EventChanged
 
shared_ptr< Type::EventAncestryChanged
 
shared_ptr< Type::EventChildAdded
 
shared_ptr< Type::EventChildRemoved
 
shared_ptr< Type::EventDescendantAdded
 
shared_ptr< Type::EventDescendantRemoving
 
OBEngineeng
 

Additional Inherited Members

- Static Public Attributes inherited from OB::Instance::Instance
static OB::ClassMetadata_ob_classmetadata
 
- Protected Member Functions inherited from OB::Instance::Instance
void fireAncestryChanged (std::vector< shared_ptr< Type::VarWrapper >> args)
 
void fireDescendantAdded (std::vector< shared_ptr< Type::VarWrapper >> args)
 
void fireDescendantRemoving (std::vector< shared_ptr< Type::VarWrapper >> args)
 
virtual void propertyChanged (std::string property)
 
- Static Protected Member Functions inherited from OB::Instance::Instance
static void propertyChanged (std::string property, shared_ptr< Instance > inst)
 
- Protected Attributes inherited from OB::Instance::Instance
bool Archivable
 
std::string Name
 
shared_ptr< InstanceParent
 
ob_int64 netId
 
std::vector< shared_ptr< Instance > > children
 
- Static Protected Attributes inherited from OB::Instance::Instance
static std::string ClassName
 
static std::string LuaClassName
 

Detailed Description

DataModel is the root singleton of the OpenBlox engine. The DataModel contains all of the core services of the engine, such as Workspace, Lighting, LogService and similar.

Author
John M. Harris, Jr.

Constructor & Destructor Documentation

◆ DataModel()

OB::Instance::DataModel::DataModel ( OBEngine eng)

◆ ~DataModel()

virtual OB::Instance::DataModel::~DataModel ( )
virtual

Member Function Documentation

◆ DECLARE_CLASS()

OB::Instance::DataModel::DECLARE_CLASS ( DataModel  )

◆ DECLARE_LUA_METHOD() [1/3]

OB::Instance::DataModel::DECLARE_LUA_METHOD ( Shutdown  )

◆ DECLARE_LUA_METHOD() [2/3]

OB::Instance::DataModel::DECLARE_LUA_METHOD ( getRobloxCompatMode  )

◆ DECLARE_LUA_METHOD() [3/3]

OB::Instance::DataModel::DECLARE_LUA_METHOD ( setRobloxCompatMode  )

◆ deserialize()

virtual void OB::Instance::DataModel::deserialize ( pugi::xml_node  thisNode)
virtual

Reimplemented from OB::Instance::Instance.

◆ dropInstance()

void OB::Instance::DataModel::dropInstance ( ob_uint64  reqNetId)

◆ fixedSerializedID()

virtual std::string OB::Instance::DataModel::fixedSerializedID ( )
virtual

Reimplemented from OB::Instance::Instance.

◆ getContentProvider()

shared_ptr<ContentProvider> OB::Instance::DataModel::getContentProvider ( )

Returns the ContentProvider service.

Returns
ContentProvider
Author
John M. Harris, Jr.

◆ getCoreGui()

shared_ptr<CoreGui> OB::Instance::DataModel::getCoreGui ( )

Returns the CoreGui service.

Returns
coreGui
Author
John M. Harris, Jr.

◆ getLighting()

shared_ptr<Lighting> OB::Instance::DataModel::getLighting ( )

Returns the Lighting service.

Returns
Lighting
Author
John M. Harris, Jr.

◆ getLogService()

shared_ptr<LogService> OB::Instance::DataModel::getLogService ( )

Returns the LogService service.

Returns
LogService
Author
John M. Harris, Jr.

◆ getPlayers()

shared_ptr<Players> OB::Instance::DataModel::getPlayers ( )

Returns the Players service.

Returns
Players
Author
John M. Harris, Jr.

◆ getProperties()

virtual std::map<std::string, _PropertyInfo> OB::Instance::DataModel::getProperties ( )
virtual

Reimplemented from OB::Instance::Instance.

◆ getProperty()

virtual shared_ptr<Type::VarWrapper> OB::Instance::DataModel::getProperty ( std::string  prop)
virtual

Reimplemented from OB::Instance::Instance.

◆ getRobloxCompatMode()

bool OB::Instance::DataModel::getRobloxCompatMode ( )

Returns whether or not Roblox Compatibility Mode is enabled.

See also
Roblox Compatibility Mode
setRobloxCompatMode
Returns
bool, true if compat mode is on, otherwise false
Author
John M. Harris, Jr.

◆ getRunService()

shared_ptr<RunService> OB::Instance::DataModel::getRunService ( )

Returns the RunService service.

Returns
RunService
Author
John M. Harris, Jr.

◆ GetService()

virtual shared_ptr<Instance> OB::Instance::DataModel::GetService ( std::string  className)
virtual

Reimplementation of ServiceProvider's GetService, this time calling ClassFactory's createService with the isDataModel parameter being true.

Parameters
classNameClass name
Returns
Instance* The service requested, or NULL if it cannot be created.
Author
John M. Harris, Jr.

Reimplemented from OB::Instance::ServiceProvider.

◆ getUserInputService()

shared_ptr<UserInputService> OB::Instance::DataModel::getUserInputService ( )

Returns the UserInputService service.

Returns
UserInputService
Author
John M. Harris, Jr.

◆ getWorkspace()

shared_ptr<Workspace> OB::Instance::DataModel::getWorkspace ( )

Returns the Workspace service.

Returns
Workspace
Author
John M. Harris, Jr.

◆ initServices()

void OB::Instance::DataModel::initServices ( )

◆ lookupInstance()

weak_ptr<Instance> OB::Instance::DataModel::lookupInstance ( ob_uint64  netId)

Returns a weak reference to an Instance with a given Network ID, or NULL.

Parameters
netIdNetwork ID
Returns
weak reference to Instance or NULL
Author
John M. Harris, Jr.

◆ nextNetworkID()

ob_uint64 OB::Instance::DataModel::nextNetworkID ( )

Returns the next network ID.

Returns
Network ID
Author
John M. Harris, Jr.

◆ preRender()

virtual void OB::Instance::DataModel::preRender ( )
virtual

Called before the scene is rendered. Called from OBEngine::render

Author
John M. Harris, Jr.

Reimplemented from OB::Instance::Instance.

◆ putInstance()

void OB::Instance::DataModel::putInstance ( shared_ptr< Instance inst)

◆ register_lua_methods()

static void OB::Instance::DataModel::register_lua_methods ( lua_State *  L)
static

◆ register_lua_property_getters()

static void OB::Instance::DataModel::register_lua_property_getters ( lua_State *  L)
static

◆ register_lua_property_setters()

static void OB::Instance::DataModel::register_lua_property_setters ( lua_State *  L)
static

◆ render()

virtual void OB::Instance::DataModel::render ( )
virtual

Renders additional scene objects, including GUI. Called from OBEngine::render

Author
John M. Harris, Jr.

Reimplemented from OB::Instance::Instance.

◆ replicateChildren()

virtual void OB::Instance::DataModel::replicateChildren ( shared_ptr< NetworkReplicator peer)
virtual

Replicates children of this Instance.

Parameters
peerPeer
Author
John M. Harris, Jr.

Reimplemented from OB::Instance::Instance.

◆ replicateProperties()

virtual void OB::Instance::DataModel::replicateProperties ( shared_ptr< NetworkReplicator peer)
virtual

Replicates properties of this Instance.

Parameters
peerPeer
Author
John M. Harris, Jr.

Reimplemented from OB::Instance::Instance.

◆ setProperty()

virtual void OB::Instance::DataModel::setProperty ( std::string  prop,
shared_ptr< Type::VarWrapper val 
)
virtual

Reimplemented from OB::Instance::Instance.

◆ setRobloxCompatMode()

void OB::Instance::DataModel::setRobloxCompatMode ( bool  robloxCompatMode)

Sets whether or not Roblox Compatibility Mode is enabled.

See also
Roblox Compatibility Mode
getRobloxCompatMode
Author
John M. Harris, Jr.

◆ Shutdown()

void OB::Instance::DataModel::Shutdown ( int  statusCode = 0)

Member Data Documentation

◆ contentProvider

shared_ptr<ContentProvider> OB::Instance::DataModel::contentProvider

◆ coreGui

shared_ptr<CoreGui> OB::Instance::DataModel::coreGui

◆ freedNetIDs

std::vector<ob_uint64> OB::Instance::DataModel::freedNetIDs

◆ instMap

std::map<ob_uint64, weak_ptr<Instance> > OB::Instance::DataModel::instMap

◆ lighting

shared_ptr<Lighting> OB::Instance::DataModel::lighting

◆ logService

shared_ptr<LogService> OB::Instance::DataModel::logService

◆ netIdNextIdx

ob_uint64 OB::Instance::DataModel::netIdNextIdx

◆ netIdStartIdx

ob_uint64 OB::Instance::DataModel::netIdStartIdx

◆ players

shared_ptr<Players> OB::Instance::DataModel::players

◆ replicatedFirst

shared_ptr<ReplicatedFirst> OB::Instance::DataModel::replicatedFirst

◆ RobloxCompatMode

bool OB::Instance::DataModel::RobloxCompatMode

◆ runService

shared_ptr<RunService> OB::Instance::DataModel::runService

◆ userInputService

shared_ptr<UserInputService> OB::Instance::DataModel::userInputService

◆ workspace

shared_ptr<Workspace> OB::Instance::DataModel::workspace

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