Inhalt
Topic:.Object_Jc.
In Java ist die Klasse Object automatisch die Basisklasse aller Daten. Damit werden gemeinsame Eigenschaften aller Daten ausgedrückt.
In der CRuntime_Javalike gibt es eine struct ObjectJc
mit zugeordneten Methoden, die als erstes Datenelement einer Anwenderstruktur, damit quasi als Basisklasse, angeordnet werden
kann. ObjectJc besteht im Standardfall aus 16 Bytes.
Nachfolgend sind die wesentlichen gemeinsame Eigenschaften dargestellt, die mit ObjectJc bzw. java.lang.Object allen Instanzen gegeben werden:
Topic:.Object_Jc..
Das Reflection-Prinzip in Java ermöglicht den symbolischen Zugriff auf alle Daten und Methoden und Typ-Tests ohne Kenntnis des Byteaufbaus (internen Struktur) der Daten. Damit wird ein Zugriffsmöglichkeit auf Daten und Methoden außerhalb einer Compiler-Linker-Verbindung hergestellt. Die Reflections benötigen in der Struktur Object_c, also pro instanziierte Daten, einen Zeiger. Pro Datentyp muss eine Zuordnungstabelle mit Typen, Name und Offset vorhanden sein. Diese kann einen größeren Umfang einnehmen (mehrere Kilobyte), wird aber im Konstanten-Bereich abgelegt. Die Zuordnungstabelle muss entweder manuell erstellt werden, oder toolunterstützt beispielsweise aus den vorhandenen Headerfiles der verwendeten Strukturen in einer Applikation. Die Zuordnungstabelle ist vom Typ class_c.
Die Reflections können auf verschiedene Weise genutzt werden: Zugriff auf Daten und Methoden einer Komponente A aus einer Komponente A heraus, ohne beide Komponenten gemeinsam compilieren und linken zu müssen. Typtest einer Klasse, Test auf Basisklassenzugehörigkeit Zugriff auf Daten und Methoden aus einem universellen Debugtool.
Auf die Nutzung von Reflections kann verzichtet werden. Dabei kann der Zeiger auf die Reflection-Definition gänzlich eingespart werden, oder der Zeiger in Object_c wird mit null belegt wenn keine Reflection-Zuordnungstabelle vorhanden ist.
Topic:.Object_Jc..
Jede Datenstruktur kann in Java Träger eines Mutex sein. Mutex heißt "mutual exclusion" - gegenseitiger Ausschluß. Ein gegenseitiger Ausschluß ist immer auf Datenzugriffe bezogen, niemals auf einen Codeabschnitt ("critical section") wie vereinfacht-irreführend oft dargestellt werden. Da jeder Datenzugriff in einem Mutithreadsystem potenziell ein Kandidat für Mutex darstellt, ist in Java die Formulierung eines Mutex direkt mit der Basisklasse Object, ohne Zusatzkonstrukte, möglich. Das geschieht in Java mittels
synchronized(data) { ... Datenzugriff }
oder einer synchronized-Methode. In der Struktur Object_c ist eine 16-bit-Variable vorgesehen, die eine Identnummer einer Semaphore tragen kann. Ist sie 0 oder -1, dann ist keine Semaphore angebunden. Damit lässt sich ähnlich einfach wie in Java mit angepassten Standardprozeduren (an ein vorhandenes Multithread-RTOS) ein Mutex realisieren. Der Verzicht auf diese Möglichkeit spart 2 Byte pro Instanz, damit sind aber extra Datenstrukturen für Mutex einzurichten.
Topic:.Object_Jc..
Wait-notify ist ein grundlegendes Konstrukt der Prozesssynchronisation. Die Abarbeitung eines Thread wird angehalten (wait), der Thread wird von einem anderen Thread aus wieder gestartet (notify), gegebenenfalls aber auch nach Ablauf einer Timeout-Zeit. Das Warten ist meist mit einem Warten auf Daten verbunden, mit dem notify werden also Daten übergeben. Daher liegt es nahe, anstatt eigenen Konstrukten das wait/notify an Daten zu binden, in Java so geschehen mit der Basisklasse Object. Der wartende Thread ruft auf
data.wait(timeout); data.checkNewData() ....
Der datenliefernde Thread ruft auf:
data.setNewData(); data.notify();
Dabei ist zusätzlich ein Umfließen mit synchronized notwendig, um einen Mutex auszuführen. In der Struktur Object_c ist eine 16-bit-Variable vorgesehen, die eine Identnummer eines wartenden Threads tragen kann. Ist sie 0 oder -1, dann diese unbenutzt. Damit lässt sich ähnlich einfach wie in Java mit angepassten Standardprozeduren (an ein vorhandenes Multithread-RTOS) ein wait/notify realisieren. Der Verzicht auf diese Möglichkeit spart 2 Byte pro Instanz, damit sind aber extra Datenstrukturen für wait/notify einzurichten.
Topic:.Object_Jc..
Daten sollen immer anzeigbar sein. Java verlangt von allen Daten-Instanzen, dass sie eine toString()-Methode anbieten. Diese Methode soll den wichtigsten Inhalt der Instanz textuell repräsentieren. Diese Methode ist weniger für die softwaretechnische Verarbeitung gedacht, sondern zur manuellen Anzeige für Reports, Debugging und dergleichen. Die Methode toString() ist in der Basisklasse Object enthalten und zeigt dort die Speicheraderesse der Instanz an. Sie kann (und sollte) in abgeleiteten Klassen überladen werden und damit einem dynamischen Binden zugänglich sein.
Mit der Struktur Object_c wird ebenfalls eine solche Methode angeboten. Mit Hilfe der Abbildung von virtuellen Methoden in C kann diese Methode auch in C überladen werden, demzufolge mit dynamischen Binden versehen.
Da die Methode toString einen String zurückliefert, ist eine Struktur String_c in diesem Zusammenhang mit definiert.
Nachfolgende Dokumentation ist direkt aus den Headerfile-Kommentierungen
in Object_Jc.h generiert, daher in englisch:
UML=/Package[objectBaseC_h]/Namespace.ownedElement[]/Class[ObjectJc]
Class ObjectJc im Package objectBaseC_h
UML=/Package[objectBaseC_h]/Namespace.ownedElement[]/Class[ObjectJc]
Object is the superclass of all superclasses. In C-like manner it is a struct at begin of any class-like struct.
Object is the superclass of all superclasses. In C-like manner it is a struct at begin of any class-like struct.
+-------'-------'-------'-------+-------'-------'-------'-------+
| objectIdentSize | ownAddress |
+-------'-------+-------'-------+-------'-------'-------'-------+
|offsetToStartAddr|idSyncHandles | reflectionClass |
+-------'-------'-------'-------+-------'-------'-------'-------+
| memoryMng | dummy |
+-------'-------'-------'-------'-------'-------'-------'-------
Info about object identification and the size of the data. There are three informations in several bits:
bit 31,30: Indication wether it is a array (type ObjectArrayJc, max. 3-dimensional).
bit 29,28: Kind of the size information.
bit 28..24 or 27..20 or 27..16: 5, 8 or 12 bits to indicate the object (instance).
bit 23 or 19 or 15 to 0: 24, 20 or 16 bits for size of the instance.
The size may be in range 0 to 65k for small Objects or to 1 MByte or 16 MByte for medium or large Objects. Bits 29,28 indicates this kind of designation.
If bit 29 is 1, it is a large object with up to 16 MByte, the sizeof-Bits are Bit 23..0. There are 5 Bits to differ user Objects, bit 28 to 24. The user may have upto 31 large Objects (instances) in one data focus or maybe in the whole software.
If bit 29, 28 is 01, it is a medium object with up to 1 MByte, the sizeof-Bits are Bit 19..0. There are 8 Bits to differ user Objects, bit 27 to 20. The user may have upto 255 medium Objects (instances) in one data focus or maybe in the whole software.
If bit 29, 28 is 00, it is a small object with up to 64 kByte, the sizeof-Bits are Bit 15..0. There are 12 Bits to differ user Objects, bit 27 to 16. The user may have upto 4095 medium Objects (instances) in one data focus or maybe in the whole software.
The ObjectIdent-Bits may be 0, if no identification of the Object is used. The user should take the responsibility for this bits. The instance idents should be defined in user space. it may be non-ambigous for a whole user project or not, but it should be non-ambigous for every data set. It helps to identify data in a plain old data (POD) structure. The user can define this bits in a special definition as constants. This constants should contain the kind-of-size bits 29 and 28. The ObjectIdent-Bits are not contained in reflection information, this information is only getable here.
The sizeof-Bits may be 0, if no sizeof information is necessarry. But this bits are usefull if some different objects are places in a memory space after another, and a memory evaluation may be processed. The memory evaluation can detect the type of the objects via Reflection. but it need not use this information. The sizeof information helps to skip from one Object to the followed.
The own address of the instance. This information is usefull if the data of the instance are transfered into another memory space (at example via file transfer). All pointers inside this instance may be relativ build with this information.
Posive value of offset to the beginn of block, able to use debugging data manually. If this Object is part of a BlockHeapBlockJc, bit 15 is set, but the rest is the positive offset to start of heap block.
identification number for wait/notify and synchronized. Because most of ObjectJc are not used for synchronized or wait/notify, the necessary handles for that are stored in a separate struct located in an separate memory space defined in os_wrapper.c. Here only the 2 bytes for a id are provided.
The info about this type of the object. The Java-like reflection-concept is used.
Pointer to a memory management, which manages this object. old: the BlockHeapBlock-Control-structure,
Initialization of the basicly data of Object and set all user data to 0. This method should be used for static and embedded instances especially in C environment and inside a C++-constructor.
sizeObj: int - The size of the whole instance, use sizeof(TypeInstance). All data are set to 0. Don't use this kind of initialization for C++-classes, use sizeof(ObjectJc) for this argument than.
identObj: int - An identification info, see class_ObjectJc.objectIdentSize return ythis
returns: ObjectJc -
Initialization of the basicly data of Object. This method should be used for all instances.
addrInstance: void - : The address of the instance itself, which contains ObjectJc. In C++ the instance address doesn't may be the same as ythis. the offset to the instance itself will be stored to help data debugging.
sizeObj: int - The size of the whole instance, use sizeof(TypeInstance).
reflection: - The reflection class. It may be null if the reflections are not present.
identObj: int - An identification info, see attribute:_ObjectJc:objectIdentSize return ythis, the reference of the Object itself.
returns: ObjectJc -
Initialization of the basicly data of Object. It is a Macro to use without any Jc-library. This method should be used for all instances.
REF: - The reference of the instance itself with type ObjectJc*
sizeObj: - The size of the whole instance which starts with ObjectJc as base struct. The memory range starting from REF will be set to 0. In C it supports 0-initializing of the data. In C++ this parameter should be set to 0, because memset() must not be used. The initializing is done in C++ by the constructor of the instance there. The sizeObj-value is added to the attribute:_ObjectJc:objectIdentSize.
identObj: - An identification info, see attribute:_ObjectJc:objectIdentSize If sizeObj is !=0, it must not contain the size info.
reflection: - The reflection class. It may be null if the reflections are not present.
returns: - void.
sets the reflection class. This method is to be called by user in its constructor of a derivated class.
reflection: - The reflection class of the instance, appropriate to the derivated type.
objectIdentSize: int32 - The type or instance and size ident.
This value will be stored immediately in the attribute objectIdentSize. The user may be set a 0-value, if no size or object
ident is used in the users scope. But if the data are saved and transfered as POD plain old data to evaluate it, this information
may be necessary for evaluation. The user should calculate this value carefully in respect to the size, instance and array
bits, see enum k..._objectIdentSize_ObjectJc
. If no ident ifno is necessary, the size may be stored here. If the object has a low size (up to 64 k in a 32-bit-System),
a simple way is to write sizeof(Type)
or sizeof(ythis)
, because the kIsSmallSize_objectIdentSize_ObjectJc is defined with 0. But it is exacting to write kIsSmallSize_objectIdentSize_ObjectJc + sizeof(ythis)
, because it is shown here that it is a small size object.
returns: void - void.
Sets the ident and size of an ObjectJc. The bit position of ident and size, and the bits to define which bits are using for ident and size mSizeBits_objectIdentSize_ObjectJc are calculated from given size and type.
sizeObj: int - The size which is valid for the memory-area, which is used from the derived whole instance.
identObj: int - any special ident. If 0, an automatically ident is built.
returns: void -
throws - RuntimeException if the identObj and sizeObj are not matching. See Bits of class_ObjectJc_objectIdentSize.
Checks the consistence of the given instance based on ObjectJc. An Object should be initialized before it is used. This method should be used in the constructor of all classes to check whether the initializing is done.
size: int - The requested size of the instance. The instance is valid if the size saved in the element objectIdentSize
is >= size. A greater instance (derived) is accepted also.
clazzReflection: - instanceof_ObjectJc() will be tested. If this param is null, no test of reflection is done. Unsupported feature: If the reflection class of the instance is null, it will be set with this reference. But call setReflection_ObjectJc() instead before, because this method may be changed in future. It should only test, not set anything!
returns: void -
gets the size of the Object stored in attribute objectIdentSize. This value helps to step through data particularly by using direct composed plain old data, but the user is responsible for the exactly realisation.
returns: int -
gets the ident and size of the Object stored in attribute objectIdentSize. This value is useable as debug information.
returns: int -
gets the reflection class.
returns: -
Returns a new Identification for an Object. This method may be implemented user-specific to generate a log file with instantiated Objects.
returns: int -
mem: MemC -
returns: ObjectJc -
MEM: -
returns: -
Allocates an memory area and initialized it with the basicly values of ObjectJc.
The element objectIdentSize is set with the size information.
The element ownAddress is set
The element reflectionClass is set to null.
All other elements are set initially. This routine assumes, that dynamically memory is present. In long-running-realtime-applications
a dynamic-memory-management may be spurious in the running phase, but maybe possible at startupt time. The implementation
of this routine may be different adequate to the system definitions. Therefore it is not implemented in the associated source
file ObjectJc.c
. The Implementation should be provided in a proper source file for memory management.
size: int - The size of the Object to allocate. If a value of -1 is given, a standard size will be allocated. This feature can be used to provide so much as possible space for a buffer.
typeInstanceIdent: int32 - Information bits, see setIdentAndSize_ObjectJc(int, int), but without the size information. The bits kIsMediumSize_objectIdentSize_ObjectJc and mIsLargeSize_objectIdentSize_ObjectJc are regarded especially.
returns: ObjectJc - the reference to the initialized Object.
throws - IndexOutOfBoundsException if the size doesn't match to typeInstanceIdent.
throws - RuntimeException if a memory space can't allocate.
Submits the responsibility to the instance to a garbage collector. It should be deleted if there are no more references to the object. The garbage collector mechanism should check whether the object is still referenced.
object: void - the object which is submitted to the GC
exclObject: void - excluding: If this addr isn't null and it is in the same block, the block doesn't activate for garbage collection. It is because a returned address may be use in the calling environment. The activating for garbage collection have to be organized there. The Java2C-Translator consideres this situation.
returns: void -
Finishes the startup phase and sets the run mode.
returns: int -
Supplies the rest of block if the Object is allocated in a block heap, or an empty MemC if there is no rest space.
size: int - The requested size (>0) or the requested number of references (<0). If < 0 then the available size is returned, where the given number of references is considered (this value negative).
returns: MemC - A MemC-information which is placed immediate after the Object, or this size_MemC(returnObject) is 0. The implementation of this method depends from a BlockHeap-Concept and is located there.
tests wether the given object is an instance of the requested Type. Javalike: instanceof-operator.
reflection: - The reflection of the type to compare.
returns: bool -
**************************************************************************************** Methods for thread synchronization
obj: ObjectJc -
returns: void -
The synchronizedEnd-Methode should be called on end of a synchronized block. write:
, synchronized(obj); , { //critical section , }synchronizedEnd(obj);
obj: ObjectJc -
returns: void -
The wait method, see java.lang.Object.wait(long), In opposite to original Java, the millisecond arg is 32 bit, so the max wait time is limited to about 24 days.
obj: ObjectJc -
milliseconds: int -
returns: void -
The notify method, see java.lang.Object.wait(long),
obj: ObjectJc -
returns: void -
The notifyAll method, see java.lang.Object.wait(long),
obj: ObjectJc -
returns: void -
CONST-Initializer sind Makros für C-Konstanten, sie sind in Headerfiles definiert. C-Konstante sind Konstrukte in { ... } mit ausschließlich konstanten Werten. Die Makros der CONST-Initializer übernehmen Argumente, die zur Compilezeit die Konstanten bestimmen. Die Initializer sind deshalb als Makros definiert, weil die Struktur der Konstanten exakt der struct-Definition folgen muss, die struct ist im Headerfile definiert, daher auch dazu passend diese Makros. Mit denCONST-Intializer ist es auf einfache Weise möglich, C-struct-Daten (Plain Old Data) zu initialisieren. Für Klassen (C++) ist dieses Konzept nicht geeignet.
This macro defines a C-constant (with {..}) for initializing any instance which is derived from Object immediately.
OBJ - The instance itself. It is used to store the OWNADDRESS and to build sizeof(OBJ) for the ObjectJc-part.
Macro for constant initialisation with a typesize and a given reflection class.
TYPESIZEOF - see attribute objectIdentSize
.
OWNADDRESS -
REFLECTION - the reflection class of the constant object. It may be null
also.
UML=/Package[ObjectJc_h]/Namespace.ownedElement[]/Class[ObjectJc]
Class ObjectJc im Package ObjectJc_h
UML=/Package[ObjectJc_h]/Namespace.ownedElement[]/Class[ObjectJc]
Object is the superclass of all superclasses. In C-like manner it is a struct at begin of any class-like struct.
Object is the superclass of all superclasses. In C-like manner it is a struct at begin of any class-like struct.
+-------'-------'-------'-------+-------'-------'-------'-------+
| objectIdentSize | ownAddress |
+-------'-------+-------'-------+-------'-------'-------'-------+
|offsetToStartAddr|idSyncHandles | reflectionClass |
+-------'-------'-------'-------+-------'-------'-------'-------+
| memoryMng | dummy |
+-------'-------'-------'-------'-------'-------'-------'-------
Info about object identification and the size of the data. There are three informations in several bits:
bit 31,30: Indication wether it is a array (type ObjectArrayJc, max. 3-dimensional).
bit 29,28: Kind of the size information.
bit 28..24 or 27..20 or 27..16: 5, 8 or 12 bits to indicate the object (instance).
bit 23 or 19 or 15 to 0: 24, 20 or 16 bits for size of the instance.
The size may be in range 0 to 65k for small Objects or to 1 MByte or 16 MByte for medium or large Objects. Bits 29,28 indicates this kind of designation.
If bit 29 is 1, it is a large object with up to 16 MByte, the sizeof-Bits are Bit 23..0. There are 5 Bits to differ user Objects, bit 28 to 24. The user may have upto 31 large Objects (instances) in one data focus or maybe in the whole software.
If bit 29, 28 is 01, it is a medium object with up to 1 MByte, the sizeof-Bits are Bit 19..0. There are 8 Bits to differ user Objects, bit 27 to 20. The user may have upto 255 medium Objects (instances) in one data focus or maybe in the whole software.
If bit 29, 28 is 00, it is a small object with up to 64 kByte, the sizeof-Bits are Bit 15..0. There are 12 Bits to differ user Objects, bit 27 to 16. The user may have upto 4095 medium Objects (instances) in one data focus or maybe in the whole software.
The ObjectIdent-Bits may be 0, if no identification of the Object is used. The user should take the responsibility for this bits. The instance idents should be defined in user space. it may be non-ambigous for a whole user project or not, but it should be non-ambigous for every data set. It helps to identify data in a plain old data (POD) structure. The user can define this bits in a special definition as constants. This constants should contain the kind-of-size bits 29 and 28. The ObjectIdent-Bits are not contained in reflection information, this information is only getable here.
The sizeof-Bits may be 0, if no sizeof information is necessarry. But this bits are usefull if some different objects are places in a memory space after another, and a memory evaluation may be processed. The memory evaluation can detect the type of the objects via Reflection. but it need not use this information. The sizeof information helps to skip from one Object to the followed.
The own address of the instance. This information is usefull if the data of the instance are transfered into another memory space (at example via file transfer). All pointers inside this instance may be relativ build with this information.
Posive value of offset to the beginn of block, able to use debugging data manually. If this Object is part of a BlockHeapBlockJc, bit 15 is set, but the rest is the positive offset to start of heap block.
identification number for wait/notify and synchronized. Because most of ObjectJc are not used for synchronized or wait/notify, the necessary handles for that are stored in a separate struct located in an separate memory space defined in os_wrapper.c. Here only the 2 bytes for a id are provided.
The info about this type of the object. The Java-like reflection-concept is used.
Pointer to a memory management, which manages this object. old: the BlockHeapBlock-Control-structure,
Initialization of the basicly data of Object and set all user data to 0. This method should be used for static and embedded instances especially in C environment and inside a C++-constructor.
sizeObj: int - The size of the whole instance, use sizeof(TypeInstance). All data are set to 0. Don't use this kind of initialization for C++-classes, use sizeof(ObjectJc) for this argument than.
identObj: int - An identification info, see class_ObjectJc.objectIdentSize return ythis
returns: ObjectJc -
Initialization of the basicly data of Object. This method should be used for all instances.
addrInstance: void - : The address of the instance itself, which contains ObjectJc. In C++ the instance address doesn't may be the same as ythis. the offset to the instance itself will be stored to help data debugging.
sizeObj: int - The size of the whole instance, use sizeof(TypeInstance).
reflection: - The reflection class. It may be null if the reflections are not present.
identObj: int - An identification info, see attribute:_ObjectJc:objectIdentSize return ythis, the reference of the Object itself.
returns: ObjectJc -
Initialization of the basicly data of Object. It is a Macro to use without any Jc-library. This method should be used for all instances.
REF: - The reference of the instance itself with type ObjectJc*
sizeObj: - The size of the whole instance which starts with ObjectJc as base struct. The memory range starting from REF will be set to 0. In C it supports 0-initializing of the data. In C++ this parameter should be set to 0, because memset() must not be used. The initializing is done in C++ by the constructor of the instance there. The sizeObj-value is added to the attribute:_ObjectJc:objectIdentSize.
identObj: - An identification info, see attribute:_ObjectJc:objectIdentSize If sizeObj is !=0, it must not contain the size info.
reflection: - The reflection class. It may be null if the reflections are not present.
returns: - void.
sets the reflection class. This method is to be called by user in its constructor of a derivated class.
reflection: - The reflection class of the instance, appropriate to the derivated type.
objectIdentSize: int32 - The type or instance and size ident.
This value will be stored immediately in the attribute objectIdentSize. The user may be set a 0-value, if no size or object
ident is used in the users scope. But if the data are saved and transfered as POD plain old data to evaluate it, this information
may be necessary for evaluation. The user should calculate this value carefully in respect to the size, instance and array
bits, see enum k..._objectIdentSize_ObjectJc
. If no ident ifno is necessary, the size may be stored here. If the object has a low size (up to 64 k in a 32-bit-System),
a simple way is to write sizeof(Type)
or sizeof(ythis)
, because the kIsSmallSize_objectIdentSize_ObjectJc is defined with 0. But it is exacting to write kIsSmallSize_objectIdentSize_ObjectJc + sizeof(ythis)
, because it is shown here that it is a small size object.
returns: void - void.
Sets the ident and size of an ObjectJc. The bit position of ident and size, and the bits to define which bits are using for ident and size mSizeBits_objectIdentSize_ObjectJc are calculated from given size and type.
sizeObj: int - The size which is valid for the memory-area, which is used from the derived whole instance.
identObj: int - any special ident. If 0, an automatically ident is built.
returns: void -
throws - RuntimeException if the identObj and sizeObj are not matching. See Bits of class_ObjectJc_objectIdentSize.
Checks the consistence of the given instance based on ObjectJc. An Object should be initialized before it is used. This method should be used in the constructor of all classes to check whether the initializing is done.
size: int - The requested size of the instance. The instance is valid if the size saved in the element objectIdentSize
is >= size. A greater instance (derived) is accepted also.
clazzReflection: - instanceof_ObjectJc() will be tested. If this param is null, no test of reflection is done. Unsupported feature: If the reflection class of the instance is null, it will be set with this reference. But call setReflection_ObjectJc() instead before, because this method may be changed in future. It should only test, not set anything!
returns: void -
gets the size of the Object stored in attribute objectIdentSize. This value helps to step through data particularly by using direct composed plain old data, but the user is responsible for the exactly realisation.
returns: int -
gets the ident and size of the Object stored in attribute objectIdentSize. This value is useable as debug information.
returns: int -
gets the reflection class.
returns: -
Returns a new Identification for an Object. This method may be implemented user-specific to generate a log file with instantiated Objects.
returns: int -
mem: MemC -
returns: ObjectJc -
MEM: -
returns: -
Allocates an memory area and initialized it with the basicly values of ObjectJc.
The element objectIdentSize is set with the size information.
The element ownAddress is set
The element reflectionClass is set to null.
All other elements are set initially. This routine assumes, that dynamically memory is present. In long-running-realtime-applications
a dynamic-memory-management may be spurious in the running phase, but maybe possible at startupt time. The implementation
of this routine may be different adequate to the system definitions. Therefore it is not implemented in the associated source
file ObjectJc.c
. The Implementation should be provided in a proper source file for memory management.
size: int - The size of the Object to allocate. If a value of -1 is given, a standard size will be allocated. This feature can be used to provide so much as possible space for a buffer.
typeInstanceIdent: int32 - Information bits, see setIdentAndSize_ObjectJc(int, int), but without the size information. The bits kIsMediumSize_objectIdentSize_ObjectJc and mIsLargeSize_objectIdentSize_ObjectJc are regarded especially.
returns: ObjectJc - the reference to the initialized Object.
throws - IndexOutOfBoundsException if the size doesn't match to typeInstanceIdent.
throws - RuntimeException if a memory space can't allocate.
Submits the responsibility to the instance to a garbage collector. It should be deleted if there are no more references to the object. The garbage collector mechanism should check whether the object is still referenced.
object: void - the object which is submitted to the GC
exclObject: void - excluding: If this addr isn't null and it is in the same block, the block doesn't activate for garbage collection. It is because a returned address may be use in the calling environment. The activating for garbage collection have to be organized there. The Java2C-Translator consideres this situation.
returns: void -
Finishes the startup phase and sets the run mode.
returns: int -
Supplies the rest of block if the Object is allocated in a block heap, or an empty MemC if there is no rest space.
size: int - The requested size (>0) or the requested number of references (<0). If < 0 then the available size is returned, where the given number of references is considered (this value negative).
returns: MemC - A MemC-information which is placed immediate after the Object, or this size_MemC(returnObject) is 0. The implementation of this method depends from a BlockHeap-Concept and is located there.
tests wether the given object is an instance of the requested Type. Javalike: instanceof-operator.
reflection: - The reflection of the type to compare.
returns: bool -
**************************************************************************************** Methods for thread synchronization
obj: ObjectJc -
returns: void -
The synchronizedEnd-Methode should be called on end of a synchronized block. write:
, synchronized(obj); , { //critical section , }synchronizedEnd(obj);
obj: ObjectJc -
returns: void -
The wait method, see java.lang.Object.wait(long), In opposite to original Java, the millisecond arg is 32 bit, so the max wait time is limited to about 24 days.
obj: ObjectJc -
milliseconds: int -
returns: void -
The notify method, see java.lang.Object.wait(long),
obj: ObjectJc -
returns: void -
The notifyAll method, see java.lang.Object.wait(long),
obj: ObjectJc -
returns: void -
CONST-Initializer sind Makros für C-Konstanten, sie sind in Headerfiles definiert. C-Konstante sind Konstrukte in { ... } mit ausschließlich konstanten Werten. Die Makros der CONST-Initializer übernehmen Argumente, die zur Compilezeit die Konstanten bestimmen. Die Initializer sind deshalb als Makros definiert, weil die Struktur der Konstanten exakt der struct-Definition folgen muss, die struct ist im Headerfile definiert, daher auch dazu passend diese Makros. Mit denCONST-Intializer ist es auf einfache Weise möglich, C-struct-Daten (Plain Old Data) zu initialisieren. Für Klassen (C++) ist dieses Konzept nicht geeignet.
This macro defines a C-constant (with {..}) for initializing any instance which is derived from Object immediately.
OBJ - The instance itself. It is used to store the OWNADDRESS and to build sizeof(OBJ) for the ObjectJc-part.
Macro for constant initialisation with a typesize and a given reflection class.
TYPESIZEOF - see attribute objectIdentSize
.
OWNADDRESS -
REFLECTION - the reflection class of the constant object. It may be null
also.