Skip to content

Commit

Permalink
Use 'itemize' instead of 'longtable' for definitions of specialized c…
Browse files Browse the repository at this point in the history
…lasses
  • Loading branch information
henrikt-ma committed Sep 22, 2020
1 parent 964a637 commit 19969aa
Showing 1 changed file with 43 additions and 60 deletions.
103 changes: 43 additions & 60 deletions chapters/classes.tex
Expand Up @@ -795,70 +795,52 @@ \subsection{Local Class Definitions -- Nested Classes}\label{local-class-definit
\section{Specialized Classes}\label{specialized-classes}

Specialized kinds of classes (earlier known as \emph{restricted classes})
% The difference between the set of specializations given here and those that are defined below need some sort of explanation.
\lstinline!record!, \lstinline!type!, \lstinline!model!, \lstinline!block!, \lstinline!package!, \lstinline!function! and \lstinline!connector!
have the properties of a general class, apart from restrictions.
Moreover, they have additional properties called enhancements. The
following table summarizes the definition of the specialized classes
Moreover, they have additional properties called \firstuse{enhancements}. The definitions of the specialized classes are given below
(additional restrictions on inheritance are in \cref{restrictions-on-the-kind-of-base-class}):
\begin{longtable}{|p{4cm}|p{9cm}|}
\hline \endhead
\lstinline!record! & Only public sections are allowed in the definition or
in any of its components (i.e., equation, algorithm, initial equation,
initial algorithm and protected sections are not allowed). The elements
of a record may not have prefixes \lstinline!input!, \lstinline!output!,
\lstinline!inner!, \lstinline!outer!, \lstinline!stream,!
or \lstinline!flow!. Enhanced with implicitly available record constructor function,
see \cref{record-constructor-functions}. The components
directly declared in a record may only be of specialized class record
or type.\\ \hline
\lstinline!type! & May only be predefined types, enumerations, array of
type, or classes extending from type.\\ \hline
\lstinline!model! & The normal modeling class in Modelica.\\ \hline
\lstinline!block! & Same as \lstinline!model! with the restriction that each connector
component of a \lstinline!block! must have prefixes \lstinline!input! and/or \lstinline!output! for all
connector variables.
\par
\begin{nonnormative*}
\begin{itemize}
\item \lstinline!record! --
Only public sections are allowed in the definition or in any of its components (i.e., \lstinline!equation!, \lstinline!algorithm!, \lstinline!initial equation!, \lstinline!initial algorithm! and \lstinline!protected! sections are not allowed). The elements of a record may not have prefixes \lstinline!input!, \lstinline!output!, \lstinline!inner!, \lstinline!outer!, \lstinline!stream,! or \lstinline!flow!. Enhanced with implicitly available record constructor function, see \cref{record-constructor-functions}. The components directly declared in a record may only be of specialized class record or type.

\item \lstinline!type! --
May only be predefined types, enumerations, array of type, or classes extending from type.

\item \lstinline!model! --
The normal modeling class in Modelica.

\item \lstinline!block! --
Same as \lstinline!model! with the restriction that each connector component of a \lstinline!block! must have prefixes \lstinline!input! and/or \lstinline!output! for all connector variables.

\begin{nonnormative}
The purpose is to model input/output blocks of block diagrams. Due to the restrictions on \lstinline!input! and \lstinline!output! prefixes,
connections between blocks are only possible according to block diagram semantic.
\end{nonnormative*}
\\ \hline
\lstinline!function! & See \cref{function-as-a-specialized-class} for restrictions
and enhancements of functions. Enhanced to allow the
function to contain an external function interface.
\par
\begin{nonnormative*}
\end{nonnormative}

\item \lstinline!function! --
See \cref{function-as-a-specialized-class} for restrictions and enhancements of functions. Enhanced to allow the function to contain an external function interface.

\begin{nonnormative}
Non-function specialized classes do not have this property.
\end{nonnormative*}
\\ \hline
\lstinline!connector! & Only public sections are allowed in the definition or in any of its
components (i.e., equation, algorithm, initial equation, initial
algorithm and protected sections are not allowed).

Enhanced to allow \lstinline!connect! to components of connector classes. The
elements of a connector may not have prefixes \lstinline!inner!, or \lstinline!outer!. May only
contain components of specialized class connector, record and
type.\\ \hline
\lstinline!package! & May only contain declarations of classes and
constants. Enhanced to allow \lstinline!import! of elements of packages. (See also
\cref{packages} on packages.)\\ \hline
\lstinline!operator record! & Similar to record; but operator overloading
is possible, and due to this the typing rules are different, see
\cref{interface-or-type-relationships}. It is not legal to extend from an operator record (or
connector inheriting from operator record), except if the new class is
an operator record or connector that is declared as a short class
definition, whose modifier is either empty or only modify the default
attributes for the component elements directly inside the operator
record. An operator record can only extend from an operator record. It is not legal to extend
from any of its enclosing scopes. (See \cref{overloaded-operators}).
\\ \hline
\lstinline!operator! & Similar to package; but may only contain
declarations of functions. May only be placed directly in an operator
record. (See also \cref{overloaded-operators}).\\ \hline
\lstinline!operator function! & Shorthand for an
operator with exactly one function; same restriction as function class
and in addition may only be placed directly in an operator
record.
\end{nonnormative}

\item \lstinline!connector! --
Only public sections are allowed in the definition or in any of its components (i.e., \lstinline!equation!, \lstinline!algorithm!, \lstinline!initial equation!, \lstinline!initial algorithm! and \lstinline!protected! sections are not allowed).

Enhanced to allow \lstinline!connect! to components of connector classes. The elements of a connector may not have prefixes \lstinline!inner!, or \lstinline!outer!. May only contain components of specialized class \lstinline!connector!, \lstinline!record! and \lstinline!type!.

\item \lstinline!package! --
May only contain declarations of classes and constants. Enhanced to allow \lstinline!import! of elements of packages. (See also \cref{packages} on packages.)

\item \lstinline!operator record! --
Similar to \lstinline!record!; but operator overloading is possible, and due to this the typing rules are different, see \cref{interface-or-type-relationships}. It is not legal to extend from an \lstinline!operator record! (or \lstinline!connector! inheriting from \lstinline!operator record!), except if the new class is an \lstinline!operator record! or \lstinline!connector! that is declared as a short class definition, whose modifier is either empty or only modify the default attributes for the component elements directly inside the \lstinline!operator record!. An \lstinline!operator record! can only extend from an \lstinline!operator record!. It is not legal to extend from any of its enclosing scopes. (See \cref{overloaded-operators}).

\item \lstinline!operator! --
Similar to \lstinline!package!; but may only contain declarations of functions. May only be placed directly in an \lstinline!operator record!. (See also \cref{overloaded-operators}).

\item \lstinline!operator function! --
Shorthand for an \lstinline!operator! with exactly one function; same restriction as \lstinline!function! class and in addition may only be placed directly in an \lstinline!operator record!.
\begin{nonnormative}
A function declaration
\begin{lstlisting}[language=modelica]
Expand All @@ -871,8 +853,9 @@ \section{Specialized Classes}\label{specialized-classes}
end foo1; end foo;
\end{lstlisting}
\end{nonnormative}
\\ \hline
\end{longtable}

\end{itemize}

Additionally only components which are of specialized classes \lstinline!record!, \lstinline!type!, \lstinline!operator record!, and
connector classes based on any of those can be used as component references in normal expressions and in the left hand
side of assignments, subject to normal type compatibility rules.
Expand Down

0 comments on commit 19969aa

Please sign in to comment.