Click here to Skip to main content
15,897,273 members
Articles / Web Development / HTML

Logician: A Table-based Rules Engine Suite in C++/.NET/JavaScript using XML

Rate me:
Please Sign up or sign in to vote.
4.90/5 (52 votes)
8 Mar 2017GPL314 min read 104.4K   6.8K   173  
Overview of a cross-platform spreadsheet-based rules enigne with algorithms implemented in C++ and JavaScript, and wrappers to C#/.NET/WinRT
/*
This file is part of the EDSEngine Library.
Copyright (C) 2009-2015 Eric D. Schmidt, DigiRule Solutions LLC

    EDSEngine 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.

    EDSEngine 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
    asize_t with EDSEngine.  If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"
#include "Bimapper.h"

CBimapper::CBimapper(void)
{
	maxID = 0;
}

CBimapper::~CBimapper(void)
{
}

void CBimapper::AddString(size_t id, const string& s)
{
	//dont assume the ids are lined up
	if (id > maxID)
		maxID = id;
	m_IndexToStringsMap[id] = s;
	m_StringsToIndexMap[s] = id;
}

string CBimapper::GetStringByID(size_t id)
{
	string retval;

	auto it = m_IndexToStringsMap.find(id);

	if (it != m_IndexToStringsMap.end())
	{
		retval = (*it).second;
	}
	return retval;
}

size_t CBimapper::GetIDByString(const string& s)
{
	size_t retval = INVALID_STRING;

	if (s.length() == 0)
	{
		return EMPTY_STRING;
	}

	auto it = m_StringsToIndexMap.find(s);
	if (it != m_StringsToIndexMap.end())
	{
		retval = (*it).second;
	} 

	return retval;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
United States United States
I have extensive experience developing software on both Linux and Windows in C++ and Python. I have also done a lot of work in the C#/.NET ecosystem. I currently work in the fields of robotics and machine learning, and also have a strong background in business automation/rules engines.

Comments and Discussions