public class VariableTableManager extends Object
Constructor and Description |
---|
VariableTableManager(RubyClass realClass)
Construct a new VariableTable Manager for the given "real" class.
|
Modifier and Type | Method and Description |
---|---|
Object |
clearVariable(RubyBasicObject object,
String name) |
void |
deserializeVariables(RubyBasicObject object,
ObjectInputStream ois) |
Object |
getFFIHandle(RubyBasicObject self)
Retrieve the FFI ext handle for the given object.
|
VariableAccessorField |
getFFIHandleAccessorField()
Retrieve the lazy accessor (VariableAccessorField) for FFI handle.
|
VariableAccessor |
getFFIHandleAccessorForRead()
Retrieve the read accessor for FFI handle.
|
VariableAccessor |
getFFIHandleAccessorForWrite()
Retrieve the write accessor for FFI handle.
|
VariableAccessorField |
getObjectGroupAccessorField()
Retrieve the lazy accessor (VariableAccessorField) for object group.
|
VariableAccessor |
getObjectGroupAccessorForRead()
Retrieve the read accessor for object group.
|
VariableAccessor |
getObjectGroupAccessorForWrite()
Retrieve the write accessor for object group.
|
long |
getObjectId(RubyBasicObject self)
Get the object_id from a given RubyBasicObject, possibly allocating
space for it.
|
VariableAccessorField |
getObjectIdAccessorField()
Retrieve the lazy accessor (VariableAccessorField) for object_id.
|
VariableAccessor |
getVariableAccessorForRead(String name)
Get the variable accessor for the given name with intent to use it for
reading.
|
VariableAccessor |
getVariableAccessorForVar(String name,
int index) |
VariableAccessor |
getVariableAccessorForWrite(String name)
Get the variable accessor for the given name with intent to use it for
writing.
|
Map<String,VariableAccessor> |
getVariableAccessorsForRead()
Get the map of all current variable accessors with intent to read from it.
|
String[] |
getVariableNames()
Get an array of all the known instance variable names.
|
Map<String,VariableAccessor> |
getVariableTableCopy()
Get a Map representing all variables registered in the variable table.
|
int |
getVariableTableSize()
Get the size of the variable table, excluding extra vars (object_id,
etc).
|
int |
getVariableTableSizeWithExtras()
Get the size of the variable table, including extra vars (object_etc,
etc).
|
boolean |
hasObjectID()
Whether this table has been used to allocate space for an object_id.
|
boolean |
hasVariables(RubyBasicObject object)
Returns true if object has any variables, defined as:
instance variables
class variables
constants
internal variables, such as those used when marshaling Ranges and Exceptions
|
void |
serializeVariables(RubyBasicObject object,
ObjectOutputStream oos) |
void |
setFFIHandle(RubyBasicObject self,
Object value)
Set the FFI handle for the given object.
|
void |
setVariableInternal(RubyBasicObject self,
int index,
Object value)
Virtual entry point for setting a variable into an object.
|
static void |
setVariableInternal(RubyClass realClass,
RubyBasicObject self,
int index,
Object value)
Static entry point for setting a variable in an object.
|
void |
syncVariables(RubyBasicObject self,
IRubyObject other)
Sync one this object's variables with other's - this is used to make
rbClone work correctly.
|
public VariableTableManager(RubyClass realClass)
realClass
- the "real" class associated with this tablepublic Map<String,VariableAccessor> getVariableAccessorsForRead()
public boolean hasObjectID()
public long getObjectId(RubyBasicObject self)
self
- the object from which to get object_idpublic void setVariableInternal(RubyBasicObject self, int index, Object value)
self
- the object into which to set the valueindex
- the index allocated for the valuevalue
- the valuepublic static void setVariableInternal(RubyClass realClass, RubyBasicObject self, int index, Object value)
realClass
- the "real" class of the objectself
- the object into which to set the variableindex
- the index allocated for the variablevalue
- the value of the variablepublic VariableAccessor getVariableAccessorForWrite(String name)
name
- the name of the variablepublic VariableAccessor getVariableAccessorForVar(String name, int index)
public VariableAccessor getVariableAccessorForRead(String name)
name
- the name of the variablepublic VariableAccessorField getObjectIdAccessorField()
public VariableAccessorField getFFIHandleAccessorField()
public VariableAccessor getFFIHandleAccessorForRead()
public VariableAccessor getFFIHandleAccessorForWrite()
public VariableAccessorField getObjectGroupAccessorField()
public VariableAccessor getObjectGroupAccessorForRead()
public VariableAccessor getObjectGroupAccessorForWrite()
public final Object getFFIHandle(RubyBasicObject self)
self
- the objectpublic final void setFFIHandle(RubyBasicObject self, Object value)
self
- the objectself
- the object's FFI handlepublic int getVariableTableSize()
public int getVariableTableSizeWithExtras()
public Map<String,VariableAccessor> getVariableTableCopy()
public String[] getVariableNames()
public void syncVariables(RubyBasicObject self, IRubyObject other)
self
- the object into which to sync variablesother
- the object from which to sync variablespublic boolean hasVariables(RubyBasicObject object)
public void serializeVariables(RubyBasicObject object, ObjectOutputStream oos) throws IOException
IOException
public void deserializeVariables(RubyBasicObject object, ObjectInputStream ois) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public Object clearVariable(RubyBasicObject object, String name)
Copyright © 2001-2015 JRuby. All Rights Reserved.