Home | Index | universal Index | gsp Index | Examples | Tutorial

IdTokenFactory Class Reference

#include "ini__IdToken.h"

Factory class for the token. More...


Inherited Class(es)


Public Functions

IdTokenFactory ( ) 
~IdTokenFactory ( ) 
create ( ) 
  • void 
destroy IdToken * & pInstance 
  • unsigned long 
getNbCreated ( ) const 

Private Variables

m_spare [ 1 ] 
  • unsigned long 
m_uAmountSpare 
  • unsigned long 
m_uStatisticNbCreated 

Private Static Variables

  • unsigned long 
MAX_SPARE 

Detailed Description

Factory class for the token.

The factory provides a 1 spare object optimisation to avoid useless and time-consuming object instantiations and destructions.

That means that the first time a token instance needs to be created and to be parsed, the token is actually created using the 'new' operator. If afterwards the parsing fails, the instance is not destroyed by the factory and is kept as a spare object that will be returned at the next creation request. Otherwise, if the parsing was successful, another object is created which may become in turn a spare object on a parse failure.


Files Included

#include "gsp__Symbol.h"
#include "universal__String.h"
#include <ctype.h>
#include <stdio.h>

Functions Documentation

IdTokenFactory ( ) 

Constructor. Constructs a default spare object.

See also:

Back to index

~IdTokenFactory ( )   [  virtual  ] 

Destructor.

See also:

Back to index

IdToken * create ( )   [  virtual  ] 

Creates an instance of the symbol. If there is a spare object available, it returns it. Otherwise a new object is created and returned.

See also:

virtual void destroy IdToken * & pInstance 
Back to index

void destroy IdToken * & pInstance   [  virtual  ] 

Destroys the instance of the symbol from the passed pointer pInstance. However, if the factory has no spare object currently in reserve, the object is not destroyed but kept as spare object that will be returned at the next creation request.

In all cases, the pointer pInstance is set to null.

See also:

virtual IdToken * create ( ) 
Back to index

unsigned long getNbCreated ( ) const 

Returns the number of instance created in all. It is NOT the number of times the create() method was called, but actually the real number of times that an instance had to be created with the 'new' operator.

See also:

virtual IdToken * create ( ) 
Back to index


This file is part of the LLOOP LL Object-Oriented Parser Generator and Object Expander Generator. Copyright (c) 2005-2006 Michel MEHL, France. All rights reserved. LLOOP is distributed by the company ERSA SaRL.


Copyright (c) 2005-2006 Michel MEHL, Haguenau, France
LLOOP version 1.1


Generated with makedoc.