...
Python
Code Block |
---|
language | py |
---|
linenumbers | true |
---|
collapse | true |
---|
|
class <name>(...):
...
def initialize():
#Assign variable values
#Initialize data
...
def execute():
#Retrieve components
#Consider ready to receive calls (Change states if appropriate)
...
def cleanUp():
#Release components
#Release resources
...
def aboutToAbort():
#Do any critical clean up
#Continue with less critical stuff such as releasing components and other activities similar to cleanUp
...
... |
Java
Code Block |
---|
language | java |
---|
linenumbers | true |
---|
collapse | true |
---|
|
import alma.acs.container.ContainerServices;
import alma.acs.component.ComponentLifecycleException;
public class <name> ... {
...
public void initialize(ContainerServices containerServices) throws ComponentLifecycleException {
super.initialize(containerServices);
//Assign variable values
//Initialize data
...
}
public void execute() {
//Retrieve components
//Consider ready to receive calls (Change states if appropriate)
...
}
public void cleanUp() {
//Release components
//Release resources
...
}
public void aboutToAbort() {
//Do any critical clean up
//Continue with less critical stuff such as releasing components and other activities similar to cleanUp
...
}
...
} |
C++
Code Block |
---|
language | cpp |
---|
linenumbers | true |
---|
collapse | true |
---|
|
class <name> : ... {
...
void initialize();
void execute();
void cleanUp();
void aboutToAbort();
...
}; |
Code Block |
---|
language | cpp |
---|
linenumbers | true |
---|
collapse | true |
---|
|
void <name>::initialize() {
//Assign variable values
//Initialize data
...
}
void <name>::execute() {
//Retrieve components
//Consider ready to receive calls (Change states if appropriate)
...
}
void <name>::cleanUp() {
//Release components
//Release resources
...
}
void <name>::aboutToAbort() {
//Do any critical clean up
//Continue with less critical stuff such as releasing components and other activities similar to cleanUp
...
} |
...
The errors defined in the XML files need to be declared in the IDLs to be used in component comunicationscommunications:
Code Block |
---|
language | cpp |
---|
linenumbers | true |
---|
collapse | true |
---|
|
...
void setMode(in boolean mode) raises(SYSTEMErr::AlreadyInAutomaticEx);
... |
...
Code Block |
---|
language | py |
---|
title | ImageType |
---|
linenumbers | true |
---|
collapse | true |
---|
|
#Sending --- Img (list of int[0-255]) to string (OctetSeq mapping)
img = [2,3,12,...]
octseq = strbytes(bytearray(img))
#Receiving --- OctetSeq mapping to Img (list of int[0-255])
octseq = takeImage(...)
b = bytearray()
b.extend(octseq)
img = list(b) |
...
Code Block |
---|
language | py |
---|
title | RGB |
---|
linenumbers | true |
---|
collapse | true |
---|
|
|
C++
Code Block |
---|
language | pycpp |
---|
title | ImageType |
---|
linenumbers | true |
---|
collapse | true |
---|
|
#Send
ImageType img;
img.length(3);
img[0] = 10;
img[1] = 20;
img[2] = 30;
#Receive
ImageType_var img = ...
for(unsigned int i = 0; i < img->length(); i++) { //You should also be able to use iterators...
...(*img)[i]...
} |
Code Block |
---|
language | py |
---|
title | ImageList |
---|
linenumbers | true |
---|
collapse | true |
---|
|
#Send
ImageList imgList;
imgList(2);
ImageType img1;
...
imgList[0] = img1;
ImageType img2;
...
imgList[1] = img1;
#Receive
imgList_var = ...
for(unsigned int i = 0; i < imgList->length(); i++) { //You should also be able to use iterators...
for(unsigned int j = 0; j < (*imgList)[i].length(); j++) { //You should also be able to use iterators...
...(*imgList)[i][j]...
} |
Code Block |
---|
|
language | py |
---|
title | ImageList |
---|
linenumbers | true |
---|
collapse | true |
Code Block |
---|
language | py |
---|
title | Position |
---|
linenumbers | true |
---|
collapse | true |
---|
|
|
...