WIP: use pt::Stream instead of a template argument

This commit is contained in:
2024-12-05 17:48:06 +01:00
parent d9ffe9b00a
commit e39311c290
12 changed files with 777 additions and 707 deletions

View File

@@ -85,6 +85,24 @@ void Blocks::ClearCache()
void Blocks::CacheObjects(Objects & obj)
{
BlocksTable::iterator i = blocks_tab.begin();
for( ; i != blocks_tab.end() ; ++i)
Cache(obj, i->second);
}
void Blocks::CacheFunctions(Functions & fun)
{
BlocksTable::iterator i = blocks_tab.begin();
for( ; i != blocks_tab.end() ; ++i)
Cache(fun, i->second);
}
void Blocks::CacheBlocks(Blocks & blocks) void Blocks::CacheBlocks(Blocks & blocks)
{ {
BlocksTable::iterator i = blocks_tab.begin(); BlocksTable::iterator i = blocks_tab.begin();
@@ -95,4 +113,5 @@ void Blocks::CacheBlocks(Blocks & blocks)
} // namespace } // namespace

View File

@@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2014-2015, Tomasz Sowa * Copyright (c) 2014-2024, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -62,8 +62,8 @@ public:
size_t Size() const; size_t Size() const;
void Clear(); void Clear();
template<class StreamType> void CacheObjects(Objects<StreamType> & obj); void CacheObjects(Objects & obj);
template<class StreamType> void CacheFunctions(Functions<StreamType> & fun); void CacheFunctions(Functions & fun);
void CacheBlocks(Blocks & blocks); void CacheBlocks(Blocks & blocks);
void ClearCache(); void ClearCache();
@@ -75,26 +75,6 @@ private:
}; };
template<class StreamType>
void Blocks::CacheObjects(Objects<StreamType> & obj)
{
BlocksTable::iterator i = blocks_tab.begin();
for( ; i != blocks_tab.end() ; ++i)
Cache(obj, i->second);
}
template<class StreamType>
void Blocks::CacheFunctions(Functions<StreamType> & fun)
{
BlocksTable::iterator i = blocks_tab.begin();
for( ; i != blocks_tab.end() ; ++i)
Cache(fun, i->second);
}
} // namespace } // namespace

View File

@@ -58,6 +58,32 @@ void Cache(Blocks & blocks, Item::Function & function)
} }
void Cache(Functions & fun, Item::Function & function)
{
function.fun_cache = 0;
if( !function.name.empty() && function.arg < 0 )
{
typename Functions::Iterator i = fun.Find(function.name);
if( i != fun.End() )
function.fun_cache = &i->second;
}
for(size_t i=0 ; i < function.parameters.size() ; ++i)
Cache(fun, *function.parameters[i]);
}
void Cache(Functions & fun, Item & item)
{
Cache(fun, item.function);
for(size_t i=0; i < item.item_tab.size() ; ++i)
Cache(fun, *item.item_tab[i]);
}
void Cache(Blocks & blocks, Item & item) void Cache(Blocks & blocks, Item & item)
{ {
@@ -68,6 +94,31 @@ void Cache(Blocks & blocks, Item & item)
} }
void Cache(Objects & objects, Item::Function & function)
{
function.base_obj = 0;
function.method_index = -1;
if( !function.name.empty() && function.arg < 0 )
{
typename Objects::Iterator i = objects.Find(function.name, function.method_index);
if( i != objects.End() )
function.base_obj = *i;
}
for(size_t i=0 ; i < function.parameters.size() ; ++i)
Cache(objects, *function.parameters[i]);
}
void Cache(Objects & objects, Item & item)
{
Cache(objects, item.function);
for(size_t i=0; i < item.item_tab.size() ; ++i)
Cache(objects, *item.item_tab[i]);
}

View File

@@ -4,8 +4,8 @@
* Author: Tomasz Sowa <t.sowa@ttmath.org> * Author: Tomasz Sowa <t.sowa@ttmath.org>
*/ */
/* /*
* Copyright (c) 2014-2015, Tomasz Sowa * Copyright (c) 2014-2024, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -48,70 +48,11 @@ namespace Ezc
class Blocks; class Blocks;
void Cache(Functions & fun, Item::Function & function);
template<class StreamType> void Cache(Functions & fun, Item & item);
void Cache(Functions<StreamType> & fun, Item::Function & function)
{
function.fun_cache = 0;
if( !function.name.empty() && function.arg < 0 )
{
typename Functions<StreamType>::Iterator i = fun.Find(function.name);
if( i != fun.End() )
function.fun_cache = &i->second;
}
for(size_t i=0 ; i < function.parameters.size() ; ++i)
Cache(fun, *function.parameters[i]);
}
template<class StreamType>
void Cache(Functions<StreamType> & fun, Item & item)
{
Cache(fun, item.function);
for(size_t i=0; i < item.item_tab.size() ; ++i)
Cache(fun, *item.item_tab[i]);
}
void Cache(Blocks & blocks, Item & item); void Cache(Blocks & blocks, Item & item);
void Cache(Objects & objects, Item::Function & function);
void Cache(Objects & objects, Item & item);
template<class StreamType>
void Cache(Objects<StreamType> & objects, Item::Function & function)
{
function.base_obj = 0;
function.method_index = -1;
if( !function.name.empty() && function.arg < 0 )
{
typename Objects<StreamType>::Iterator i = objects.Find(function.name, function.method_index);
if( i != objects.End() )
function.base_obj = *i;
}
for(size_t i=0 ; i < function.parameters.size() ; ++i)
Cache(objects, *function.parameters[i]);
}
template<class StreamType>
void Cache(Objects<StreamType> & objects, Item & item)
{
Cache(objects, item.function);
for(size_t i=0; i < item.item_tab.size() ; ++i)
Cache(objects, *item.item_tab[i]);
}
} // namespace Ezc } // namespace Ezc

109
src/functions.cpp Normal file
View File

@@ -0,0 +1,109 @@
/*
* This file is a part of EZC -- Easy templating in C++ library
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2024, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "functions.h"
namespace Ezc
{
void Functions::Insert(const char * key, UserFunction ufunction)
{
pt::utf8_to_wide(key, temp_key);
functions_tab[temp_key] = ufunction;
temp_key.clear();
}
void Functions::Insert(const std::string & key, UserFunction ufunction)
{
Insert(key.c_str(), ufunction);
}
void Functions::Insert(const wchar_t * key, UserFunction ufunction)
{
temp_key = key;
functions_tab[temp_key] = ufunction;
temp_key.clear();
}
void Functions::Insert(const std::wstring & key, UserFunction ufunction)
{
functions_tab[key] = ufunction;
}
typename Functions::Iterator Functions::Find(const std::wstring & key)
{
return functions_tab.find(key);
}
void Functions::Clear()
{
functions_tab.clear();
}
typename Functions::Iterator Functions::Begin()
{
return functions_tab.begin();
}
typename Functions::Iterator Functions::End()
{
return functions_tab.end();
}
size_t Functions::Size() const
{
return functions_tab.size();
}
} // namespace Ezc

View File

@@ -4,8 +4,8 @@
* Author: Tomasz Sowa <t.sowa@ttmath.org> * Author: Tomasz Sowa <t.sowa@ttmath.org>
*/ */
/* /*
* Copyright (c) 2007-2015, Tomasz Sowa * Copyright (c) 2007-2024, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -48,12 +48,11 @@ namespace Ezc
// functions or variables // functions or variables
template<class StreamType>
class Functions class Functions
{ {
public: public:
typedef void (*UserFunction)(FunInfo<StreamType> &); typedef void (*UserFunction)(FunInfo &);
typedef std::map<std::wstring, UserFunction> FunctionsTable; typedef std::map<std::wstring, UserFunction> FunctionsTable;
typedef typename FunctionsTable::iterator Iterator; typedef typename FunctionsTable::iterator Iterator;
@@ -79,84 +78,6 @@ private:
template<class StreamType>
void Functions<StreamType>::Insert(const char * key, UserFunction ufunction)
{
pt::utf8_to_wide(key, temp_key);
functions_tab[temp_key] = ufunction;
temp_key.clear();
}
template<class StreamType>
void Functions<StreamType>::Insert(const std::string & key, UserFunction ufunction)
{
Insert(key.c_str(), ufunction);
}
template<class StreamType>
void Functions<StreamType>::Insert(const wchar_t * key, UserFunction ufunction)
{
temp_key = key;
functions_tab[temp_key] = ufunction;
temp_key.clear();
}
template<class StreamType>
void Functions<StreamType>::Insert(const std::wstring & key, UserFunction ufunction)
{
functions_tab[key] = ufunction;
}
template<class StreamType>
typename Functions<StreamType>::Iterator Functions<StreamType>::Find(const std::wstring & key)
{
return functions_tab.find(key);
}
template<class StreamType>
void Functions<StreamType>::Clear()
{
functions_tab.clear();
}
template<class StreamType>
typename Functions<StreamType>::Iterator Functions<StreamType>::Begin()
{
return functions_tab.begin();
}
template<class StreamType>
typename Functions<StreamType>::Iterator Functions<StreamType>::End()
{
return functions_tab.end();
}
template<class StreamType>
size_t Functions<StreamType>::Size() const
{
return functions_tab.size();
}
} // namespace Ezc } // namespace Ezc

View File

@@ -4,8 +4,8 @@
* Author: Tomasz Sowa <t.sowa@ttmath.org> * Author: Tomasz Sowa <t.sowa@ttmath.org>
*/ */
/* /*
* Copyright (c) 2007-2023, Tomasz Sowa * Copyright (c) 2007-2024, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -39,6 +39,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include "item.h" #include "item.h"
#include "textstream/stream.h"
@@ -143,12 +144,11 @@ struct Stack
// !! IMPROVE ME // !! IMPROVE ME
// the name is bad // the name is bad
// may it should be called Env (environment) or FunEnv // may it should be called Env (environment) or FunEnv
template<class StreamType>
struct FunInfo struct FunInfo
{ {
// a result consists of a string and a boolean value // a result consists of a string and a boolean value
// output stream // output stream
StreamType & out; pt::Stream & out;
// return value from a user's function (default false if not set directly by the function) // return value from a user's function (default false if not set directly by the function)
bool res; bool res;
@@ -163,7 +163,7 @@ struct FunInfo
// an input stream used in [filter] statement // an input stream used in [filter] statement
// if there is other statement than [filter] then this is an empty stream // if there is other statement than [filter] then this is an empty stream
const StreamType & in; const pt::Stream & in;
// indicates that this function is from [for ...] statement // indicates that this function is from [for ...] statement
bool is_for; bool is_for;
@@ -207,10 +207,10 @@ struct FunInfo
// arguments: output_stream, table_of_parameters, the_first_parameter // arguments: output_stream, table_of_parameters, the_first_parameter
FunInfo(StreamType & o, FunInfo(pt::Stream & o,
std::vector<Var> & pars, std::vector<Var> & pars,
const std::wstring & first_par, const std::wstring & first_par,
const StreamType & input_stream, const pt::Stream & input_stream,
Stack & s, Stack & s,
const Item & item_) : out(o), params(pars), par(first_par), in(input_stream), stack(s), item(item_) const Item & item_) : out(o), params(pars), par(first_par), in(input_stream), stack(s), item(item_)
{ {

File diff suppressed because it is too large Load Diff

104
src/objects.cpp Normal file
View File

@@ -0,0 +1,104 @@
/*
* This file is a part of EZC -- Easy templating in C++ library
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2024, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "objects.h"
namespace Ezc
{
typename Objects::Iterator Objects::Find(const std::wstring & key, int & method_index)
{
Iterator i = obj_tab.begin();
method_index = -1;
for( ; i != obj_tab.end() ; ++i)
{
int index = (*i)->FindFun(key);
if( index != -1 )
{
method_index = index;
return i;
}
}
return obj_tab.end();
}
void Objects::Insert(BaseObj * base_fun)
{
obj_tab.push_back(base_fun);
}
void Objects::Insert(BaseObj & base_fun)
{
obj_tab.push_back(&base_fun);
}
typename Objects::Iterator Objects::Begin()
{
return obj_tab.begin();
}
typename Objects::Iterator Objects::End()
{
return obj_tab.end();
}
size_t Objects::Size() const
{
return obj_tab.size();
}
void Objects::Clear()
{
obj_tab.clear();
}
} // namespace Ezc

View File

@@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2015, Tomasz Sowa * Copyright (c) 2015-2024, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "utf8/utf8.h" #include "utf8/utf8.h"
#include "funinfo.h"
@@ -46,7 +47,6 @@ namespace Ezc
{ {
template<class StreamType>
class BaseObj class BaseObj
{ {
public: public:
@@ -69,7 +69,7 @@ public:
/* /*
* *
*/ */
virtual void CallFun(int fun_index, FunInfo<StreamType> &) = 0; virtual void CallFun(int fun_index, FunInfo &) = 0;
/* /*
@@ -203,16 +203,15 @@ private:
template<class StreamType>
class Objects class Objects
{ {
public: public:
typedef std::vector<BaseObj<StreamType> * > ObjectsTable; typedef std::vector<BaseObj*> ObjectsTable;
typedef typename ObjectsTable::iterator Iterator; typedef typename ObjectsTable::iterator Iterator;
void Insert(BaseObj<StreamType> * base_fun); void Insert(BaseObj * base_fun);
void Insert(BaseObj<StreamType> & base_fun); void Insert(BaseObj & base_fun);
Iterator Begin(); Iterator Begin();
Iterator End(); Iterator End();
@@ -229,73 +228,6 @@ private:
template<class StreamType>
typename Objects<StreamType>::Iterator Objects<StreamType>::Find(const std::wstring & key, int & method_index)
{
Iterator i = obj_tab.begin();
method_index = -1;
for( ; i != obj_tab.end() ; ++i)
{
int index = (*i)->FindFun(key);
if( index != -1 )
{
method_index = index;
return i;
}
}
return obj_tab.end();
}
template<class StreamType>
void Objects<StreamType>::Insert(BaseObj<StreamType> * base_fun)
{
obj_tab.push_back(base_fun);
}
template<class StreamType>
void Objects<StreamType>::Insert(BaseObj<StreamType> & base_fun)
{
obj_tab.push_back(&base_fun);
}
template<class StreamType>
typename Objects<StreamType>::Iterator Objects<StreamType>::Begin()
{
return obj_tab.begin();
}
template<class StreamType>
typename Objects<StreamType>::Iterator Objects<StreamType>::End()
{
return obj_tab.end();
}
template<class StreamType>
size_t Objects<StreamType>::Size() const
{
return obj_tab.size();
}
template<class StreamType>
void Objects<StreamType>::Clear()
{
obj_tab.clear();
}
} // namespace Ezc } // namespace Ezc

View File

@@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2015-2021, Tomasz Sowa * Copyright (c) 2015-2024, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,7 @@
#ifndef headerfile_ezc_outstreams #ifndef headerfile_ezc_outstreams
#define headerfile_ezc_outstreams #define headerfile_ezc_outstreams
#include "textstream/stream.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
@@ -44,18 +45,17 @@ namespace Ezc
{ {
template<class StreamType, bool is_pikotools_stream = false>
class OutStreams class OutStreams
{ {
public: public:
typedef std::map<std::wstring, StreamType*> StreamsMap; typedef std::map<std::wstring, pt::Stream*> StreamsMap;
typedef std::vector<StreamType*> StreamsTab; typedef std::vector<pt::Stream*> StreamsTab;
StreamsMap streams_map; StreamsMap streams_map;
StreamsTab streams_tab; StreamsTab streams_tab;
void ResizeTab(size_t len); void ResizeTab(pt::Stream & stream_type, size_t len);
void ClearMap(); void ClearMap();
void ClearTab(); void ClearTab();
@@ -68,40 +68,35 @@ public:
}; };
template<class StreamType, bool is_pikotools_stream> OutStreams::~OutStreams()
OutStreams<StreamType, is_pikotools_stream>::~OutStreams()
{ {
ClearTab(); ClearTab();
} }
template<class StreamType, bool is_pikotools_stream> OutStreams::OutStreams()
OutStreams<StreamType, is_pikotools_stream>::OutStreams()
{ {
} }
template<class StreamType, bool is_pikotools_stream> OutStreams::OutStreams(const OutStreams & o)
OutStreams<StreamType, is_pikotools_stream>::OutStreams(const OutStreams<StreamType, is_pikotools_stream> & o)
{ {
// we do not copy streams but creating new ones // we do not copy streams but creating new ones
ResizeTab(o.streams_tab.size()); //ResizeTab(o.streams_tab.size());
} }
template<class StreamType, bool is_pikotools_stream> OutStreams & OutStreams::operator=(const OutStreams & o)
OutStreams<StreamType, is_pikotools_stream> & OutStreams<StreamType, is_pikotools_stream>::operator=(const OutStreams<StreamType, is_pikotools_stream> & o)
{ {
// we do not copy streams but creating new ones // we do not copy streams but creating new ones
streams_map.clear(); streams_map.clear();
ResizeTab(o.streams_tab.size()); //ResizeTab(o.streams_tab.size());
return *this; return *this;
} }
template<class StreamType, bool is_pikotools_stream> void OutStreams::ClearTab()
void OutStreams<StreamType, is_pikotools_stream>::ClearTab()
{ {
for(size_t i=0 ; i<streams_tab.size() ; ++i) for(size_t i=0 ; i<streams_tab.size() ; ++i)
delete streams_tab[i]; delete streams_tab[i];
@@ -111,8 +106,7 @@ void OutStreams<StreamType, is_pikotools_stream>::ClearTab()
} }
template<class StreamType, bool is_pikotools_stream> void OutStreams::ResizeTab(pt::Stream & stream_type, size_t len)
void OutStreams<StreamType, is_pikotools_stream>::ResizeTab(size_t len)
{ {
if( streams_tab.size() != len ) if( streams_tab.size() != len )
{ {
@@ -122,7 +116,7 @@ void OutStreams<StreamType, is_pikotools_stream>::ResizeTab(size_t len)
streams_tab.resize(len); streams_tab.resize(len);
for( ; i<streams_tab.size() ; ++i) for( ; i<streams_tab.size() ; ++i)
streams_tab[i] = new StreamType(); streams_tab[i] = stream_type.new_empty();
} }
else else
{ {
@@ -137,23 +131,23 @@ void OutStreams<StreamType, is_pikotools_stream>::ResizeTab(size_t len)
} }
template<class StreamType, bool is_pikotools_stream> void OutStreams::ClearMap()
void OutStreams<StreamType, is_pikotools_stream>::ClearMap()
{ {
typename StreamsMap::iterator i; typename StreamsMap::iterator i;
for(i=streams_map.begin() ; i != streams_map.end() ; ++i) for(i=streams_map.begin() ; i != streams_map.end() ; ++i)
{ {
StreamType & str = *(i->second); pt::Stream & str = *(i->second);
str.clear();
if constexpr(is_pikotools_stream) // if constexpr(is_pikotools_stream)
{ // {
str.clear(); // str.clear();
} // }
else // else
{ // {
str.str(L""); // str.str(L"");
} // }
} }
streams_map.clear(); streams_map.clear();

View File

@@ -4,8 +4,8 @@
* Author: Tomasz Sowa <t.sowa@ttmath.org> * Author: Tomasz Sowa <t.sowa@ttmath.org>
*/ */
/* /*
* Copyright (c) 2007-2015, Tomasz Sowa * Copyright (c) 2007-2024, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -56,9 +56,9 @@ public:
void Clear(); void Clear();
template<class StreamType> void CacheFunctions(Functions<StreamType> & fun); void CacheFunctions(Functions & fun);
void CacheBlocks(Blocks & blocks); void CacheBlocks(Blocks & blocks);
template<class StreamType> void CacheObjects(Objects<StreamType> & obj); void CacheObjects(Objects & obj);
void ClearCache(); void ClearCache();
@@ -69,15 +69,13 @@ public:
template<class StreamType> void Pattern::CacheFunctions(Functions & fun)
void Pattern::CacheFunctions(Functions<StreamType> & fun)
{ {
Cache(fun, item_root); Cache(fun, item_root);
} }
template<class StreamType> void Pattern::CacheObjects(Objects & obj)
void Pattern::CacheObjects(Objects<StreamType> & obj)
{ {
Cache(obj, item_root); Cache(obj, item_root);
} }