MCPcopy Create free account
hub / github.com/anjo76/angelscript / RemoveConfigGroup

Method RemoveConfigGroup

sdk/angelscript/source/as_scriptengine.cpp:5814–5859  ·  view source on GitHub ↗

interface

Source from the content-addressed store, hash-verified

5812
5813// interface
5814int asCScriptEngine::RemoveConfigGroup(const char *groupName)
5815{
5816 // It is not allowed to remove a group that is still in use.
5817
5818 // It would be possible to change the code in such a way that
5819 // the group could be removed even though it was still in use,
5820 // but that would cause severe negative impact on runtime
5821 // performance, since the VM would then have to be able handle
5822 // situations where the types, functions, and global variables
5823 // can be removed at any time.
5824
5825 for( asUINT n = 0; n < configGroups.GetLength(); n++ )
5826 {
5827 if( configGroups[n]->groupName == groupName )
5828 {
5829 asCConfigGroup *group = configGroups[n];
5830
5831 // Remove any unused generated template instances
5832 // before verifying if the config group is still in use.
5833 // RemoveTemplateInstanceType() checks if the instance is in use
5834 for( asUINT g = generatedTemplateTypes.GetLength(); g-- > 0; )
5835 RemoveTemplateInstanceType(generatedTemplateTypes[g]);
5836
5837 // Make sure the group isn't referenced by anyone
5838 if( group->refCount > 0 )
5839 return asCONFIG_GROUP_IS_IN_USE;
5840
5841 // Verify if any objects registered in this group is still alive
5842 if( group->HasLiveObjects() )
5843 return asCONFIG_GROUP_IS_IN_USE;
5844
5845 // Remove the group from the list
5846 if( n == configGroups.GetLength() - 1 )
5847 configGroups.PopLast();
5848 else
5849 configGroups[n] = configGroups.PopLast();
5850
5851 // Remove the configurations registered with this group
5852 group->RemoveConfiguration(this);
5853
5854 asDELETE(group,asCConfigGroup);
5855 }
5856 }
5857
5858 return 0;
5859}
5860
5861asCConfigGroup *asCScriptEngine::FindConfigGroupForFunction(int funcId) const
5862{

Callers 2

TestFunction · 0.80
Test2Function · 0.80

Calls 4

HasLiveObjectsMethod · 0.80
PopLastMethod · 0.80
RemoveConfigurationMethod · 0.80
GetLengthMethod · 0.45

Tested by 2

TestFunction · 0.64
Test2Function · 0.64