next up previous
Next: Communication model of OpenXM Up: Design and Implementation of Previous: CMO Primitive object

A formal expression of CMO

In the previous section, we have explained the format of CMO's in the Primitive group. In this section, we will introduce CMOexpression which is like the bracket expression of Lisp. We again explain a standard encoding method of CMO, which we have already explained in the previous section.

Let us define CMOexpression by the extended BNF expression. Symbols in the type writer fonts mean terminals. ``:'' means a definition. ``|'' means ''or''. { X } is a repetition of X of more than or equal to 0 times. [ x ] stands for X or nothing. By using this notation, CMOexpression is defined as follows.


\begin{eqnarray*}\mbox{CMOexpression}
&:& \quad
\mbox{\tt (} \mbox{\tt cmo\_tag...
...\
& &\vert\ \mbox{\tt string} \\
& &\vert\ \mbox{\tt byte} \\
\end{eqnarray*}


Terminal int32 is signed 32 bit integer. Terminal string is a byte array which usually expresses a string. Terminal byte is 8 bit data.

The comma (,) may be used to separate each element in CMOexpressions. cmo_tag is a constant that starts with CMO_.

Let us describe CMO's in the Primitive group. In order to explain the meaning of objects, we may also put variable names to CMOexpressions. The start of comments are denoted by ``--''.

By using this notation, let us define formally CMObjects in the group Primitive.

Group CMObject/Primitive requires nothing.
Error2, Null, Integer32, Datum, Cstring, Mathcap, List $\in$ CMObject/Primitive.
Document of CMObject/Primitive is at http://www.math.kobe-u.ac.jp/OpenXM (in English and Japanese)

\begin{eqnarray*}\mbox{Error2}&:& ({\tt CMO\_ERROR2}, {\sl CMObject}\, \mbox{ob}...
...ct}\, ob[m-1])} \\
& & \mbox{--- m is the length of the list.}
\end{eqnarray*}


In the definition of ``Cstring'', if we decompose ``string s'' into bytes, then ``Cstring'' should be defined as

\begin{eqnarray*}\mbox{Cstring}&:& ({\tt CMO\_STRING},{\sl int32}\, \mbox{ n},
{\sl byte}\, \mbox{s[0]},
\ldots, {\sl byte}\ \mbox{s[n-1]})
\end{eqnarray*}


``Group CMObject/Primitive requires nothing'' means that there is no super group to define CMO's in the group Primitive. ``Error2, Null, Integer32, Datum, Cstring, Mathcap, List $\in$ CMObject/Primitive'' means that Error2, Null, Integer32, Datum, Cstring are members of the group CMObject/Primitive.

Let us see examples. 32 bit integer 1234 is expressed as

(CMO_INT32, 1234)

The string ``Hello'' is expressed as

(CMO_STRING, 5, "Hello")

Let us explain the standard encoding method. All int32 data are encoded into network byte order 32 bit integers and byte data are encoded as it is.

When we are using a high speed network, the translation from the internal expression of 32 bit integers to network byte order may become a bottle neck. There are experimental data which presents that 90 percents of the transmission time are for the translation to the network byte order to send CMO_ZZ of size 12M bytes on a 100Mbps network. In a later section, we will discuss a protocol to avoid the translation.

The translation between the standard encoding and CMOexpression is easy. For example,

int32 CMO_INT32 int32 1234

is the encoding of the CMOexpression

(CMO_INT32, 1234)


next up previous
Next: Communication model of OpenXM Up: Design and Implementation of Previous: CMO Primitive object
Nobuki Takayama 平成12年4月13日