Classes | Defines | Typedefs | Functions
base2.c File Reference
#include "base2_friend.h"

Go to the source code of this file.

Classes

struct  base2_private_st_

Defines

#define BASE2_STR_SIZE   64

Typedefs

typedef struct base2_private_st_ base2_private_st

Functions

my_rc_e base2_string_size (base2_handle base2_h, size_t *buffer_size)
const char * base2_type_string (base2_handle base2_h)
my_rc_e base2_string (base2_handle base2_h, char *buffer, size_t buffer_size)
void base2_friend_delete (base2_handle base2_h)
void base2_delete (base2_handle base2_h)
my_rc_e base2_increase_val1 (base2_handle base2_h)
my_rc_e base2_get_val1 (base2_handle base2_h, uint32_t *val1)
my_rc_e base2_inherit_vtable (const base2_vtable_st *parent_vtable, base2_vtable_st *child_vtable, bool do_null_check)
my_rc_e base2_set_vtable (base2_handle base2_h, base2_vtable_st *vtable)
my_rc_e base2_init (base2_handle base2_h)

Detailed Description

Author:
Matt Miller <matt@matthewjmiller.net>

LICENSE

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

DESCRIPTION

This is the implements a base class from which children class may inherit. Note that this is an abstract class with a pure virtual function and no constructor.

Definition in file base2.c.


Define Documentation

#define BASE2_STR_SIZE   64

Size for this object to use for base2_string_size_fn

Definition at line 29 of file base2.c.


Typedef Documentation

Private variables which cannot be directly accessed by any other class including children.


Function Documentation

void base2_delete ( base2_handle  base2_h)

Delete the object. This is a virtual function. Upon return, the object is not longer valid.

Parameters:
base2_hThe object. If NULL, then this function is a no-op.

Definition at line 246 of file base2.c.

void base2_friend_delete ( base2_handle  base2_h)

Allow a friend class to delete the base2 object. It is assumed that the friend class is managing the memory for the base2 object and, thus, the object will not be freed. However, members within the base2 object may be freed. This does not call the virtual function table version of delete, but rather the delete specifically for type base2.

Parameters:
base2_hThe object. If NULL, then this function is a no-op.
See also:
base2_delete()

Definition at line 220 of file base2.c.

my_rc_e base2_get_val1 ( base2_handle  base2_h,
uint32_t *  val1 
)

Get the current val1 value for the object.

Parameters:
base2_hThe object
val1Outputs the current value.
Returns:
Return code

Definition at line 285 of file base2.c.

my_rc_e base2_increase_val1 ( base2_handle  base2_h)

Increase val3 for the object. This is a pure virtual function.

Parameters:
base2_hThe object
Returns:
Return code

Definition at line 265 of file base2.c.

my_rc_e base2_inherit_vtable ( const base2_vtable_st parent_vtable,
base2_vtable_st child_vtable,
bool  do_null_check 
)

Fill in the child vtable with values inherited from the parent_vtable for all functions left NULL in the child vtable.

Parameters:
parent_vtableThe parent vtable from which to inherit.
child_vtableThe child vtable to which functions may be inherited.
do_null_checkIndicates whether an error should be thrown if a function in the child vtable is NULL after inheritance.

Definition at line 320 of file base2.c.

my_rc_e base2_init ( base2_handle  base2_h)

Allows a friend class to initialize their inner base2 object. Must be called before the base2 object is used. If an error is returned, any clean-up was handled internally and there is no need to call a delete function.

Parameters:
base2_hThe object
Returns:
Return code
See also:
base2_delete()
base2_friend_delete()

Definition at line 399 of file base2.c.

my_rc_e base2_set_vtable ( base2_handle  base2_h,
base2_vtable_st vtable 
)

This is a function used by friend classes to set the virtual table according to which methods they wish to override.

Parameters:
base2_hThe object
vtableThe virtual table specification for the friend class. If a function pointer is NULL, then the base2 function is inherited.
Returns:
Return code

Definition at line 363 of file base2.c.

my_rc_e base2_string ( base2_handle  base2_h,
char *  buffer,
size_t  buffer_size 
)

Get a string representation of the object. This is a virtual function.

Parameters:
base2_hThe object
bufferThe buffer in which to put the string.
buffer_sizeThe size of the buffer.
Returns:
Return code
See also:
base2_string_size()

Definition at line 127 of file base2.c.

my_rc_e base2_string_size ( base2_handle  base2_h,
size_t *  buffer_size 
)

Get the minimum size of a string buffer that should be used to get a string representation of the object. This is a virtual function.

Parameters:
base2_hThe object
buffer_sizeOutputs the size of the buffer that should be used.
Returns:
Return code
See also:
base2_string()

Definition at line 50 of file base2.c.

const char* base2_type_string ( base2_handle  base2_h)

Get the string describing the type of the object. This is a virtual function.

Parameters:
base2_hThe object
Returns:
The string indicating the object type.

Definition at line 105 of file base2.c.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines