<commit_before>#include "ofxXmlSettings.h"

#include <vector>
#include <string>
#include <iostream>

//----------------------------------------
// a pretty useful tokenization system:
static vector<string> tokenize(const string & str, const string & delim);
static vector<string> tokenize(const string & str, const string & delim)
{
  vector<string> tokens;

  size_t p0 = 0, p1 = string::npos;
  while(p0 != string::npos)
  {
    p1 = str.find_first_of(delim, p0);
    if(p1 != p0)
    {
      string token = str.substr(p0, p1 - p0);
      tokens.push_back(token);
    }
    p0 = str.find_first_not_of(delim, p1);
  }
  return tokens;
}
//----------------------------------------

ofxXmlSettings::ofxXmlSettings(){
	storedHandle	= new TiXmlHandle(NULL);
	level			= 0;
	//we do this so that we have a valid handle
	//without the need for loadFile
	*storedHandle   = TiXmlHandle(&doc);
}

//---------------------------------------------------------
void ofxXmlSettings::setVerbose(bool _verbose){
}

//---------------------------------------------------------
void ofxXmlSettings::clear(){
	//we clear from our root level
	//this is usually the document
	//but if we are pushed  - it could
	//be all the tags inside of the pushed
	//node - including the node itself!

	storedHandle->ToNode()->Clear();
}

//---------------------------------------------------------
bool ofxXmlSettings::loadFile(string xmlFile){

	xmlFile = ofToDataPath(xmlFile);

	bool loadOkay = doc.LoadFile(xmlFile.c_str());

	//theo removed bool check as it would
	//return false if the file exists but was
	//empty

    //our push pop level should be set to 0!
	level = 0;

	*storedHandle = TiXmlHandle(&doc);
	return loadOkay;
}

//---------------------------------------------------------
void ofxXmlSettings::saveFile(string xmlFile){

	xmlFile = ofToDataPath(xmlFile);
	doc.SaveFile(xmlFile.c_str());
}

//---------------------------------------------------------
void ofxXmlSettings::clearTagContents(string tag, int which){
	//we check it first to see if it exists
	//otherwise setValue will make a new empty tag
	if( tagExists(tag, which) )setValue(tag, "", which);
}

//---------------------------------------------------------
void ofxXmlSettings::removeTag(string  tag, int which){

	vector<string> tokens = tokenize(tag,":");

	//no tags so we return
	if( tokens.size() == 0 ) return;

	//grab the handle from the level we are at
	//normally this is the doc but could be a pushed node
	TiXmlHandle tagHandle = *storedHandle;

	if(which < 0) which = 0;

	for(int x=0;x<tokens.size();x++){

		//we only support multi tags
		//with same name at root level
		if(x > 0) which = 0;

		TiXmlHandle isRealHandle = tagHandle.ChildElement( tokens.at(x), which);

		if ( !isRealHandle.Node() ) break;
		else{
			if (x == tokens.size()-1){
				//if we are at the last tag and it exists
				//we use its parent to remove it - haha
				tagHandle.ToNode()->RemoveChild( isRealHandle.ToNode() );
			}
			tagHandle = isRealHandle;
		}
	}

	tokens.clear();
}

//---------------------------------------------------------
int ofxXmlSettings::getValue(string tag, int defaultValue, int which){
	char * tempStr = new char[MAX_TAG_VALUE_LENGTH_IN_CHARS];
	memset(tempStr, 0, MAX_TAG_VALUE_LENGTH_IN_CHARS);
	int returnValue = defaultValue;

	if (readTag(tag, tempStr, which)){
		returnValue = strtol(tempStr, NULL, 0);
	}
	delete tempStr;
	return returnValue;
}

//---------------------------------------------------------
float ofxXmlSettings::getValue(string tag, double defaultValue, int which){
	char * tempStr = new char[MAX_TAG_VALUE_LENGTH_IN_CHARS];
	memset(tempStr, 0, MAX_TAG_VALUE_LENGTH_IN_CHARS);
	float returnValue = defaultValue;

	if (readTag(tag, tempStr, which)){
		returnValue = strtod(tempStr,  NULL);
	}
	delete tempStr;
	return returnValue;
}

//---------------------------------------------------------
string ofxXmlSettings::getValue(string tag, string defaultValue, int which){

	// lots of char *, string kung-fu here...

	char * tempStr = new char[MAX_TAG_VALUE_LENGTH_IN_CHARS];
	memset(tempStr, 0, MAX_TAG_VALUE_LENGTH_IN_CHARS);
	char * returnPtr = (char *) defaultValue.c_str();
	if (readTag(tag, tempStr, which)){
		returnPtr = tempStr;
	}
	string returnString(returnPtr);
	delete tempStr;
	return returnString;
}

//---------------------------------------------------------
bool ofxXmlSettings::readTag(string  tag, char * valueString, int which){

	vector<string> tokens = tokenize(tag,":");

	TiXmlHandle tagHandle = *storedHandle;
	for(int x=0;x<tokens.size();x++){
		if(x == 0)tagHandle = tagHandle.ChildElement(tokens.at(x), which);
		else tagHandle = tagHandle.FirstChildElement( tokens.at(x) );
	}

	// once we've walked, let's get that value...
	TiXmlHandle valHandle = tagHandle.Child( 0 );

    //now, clear that vector!
	tokens.clear();

    // if that value is really text, let's get the value out of it !
    if (valHandle.Text()){
    	int maxLen = MIN(MAX_TAG_VALUE_LENGTH_IN_CHARS, strlen(valHandle.Text()->Value()));
    	memcpy(valueString, valHandle.Text()->Value(), maxLen);
    	return true;
    }  else {
		return false;
	}
}

//---------------------------------------------------------
bool ofxXmlSettings::pushTag(string  tag, int which){

	int pos = tag.find(":");

	if(pos > 0){
		tag = tag.substr(0,pos);
	}

	//we only allow to push one tag at a time.
	TiXmlHandle isRealHandle = storedHandle->ChildElement(tag, which);

	if( isRealHandle.Node() ){
		*storedHandle = isRealHandle;
		level++;
		return true;
	}else{
		printf("pushTag - tag not found\n");
	}

	return false;
}

//---------------------------------------------------------
int ofxXmlSettings::popTag(){

	if(level >= 1){
		TiXmlHandle parent( (storedHandle->ToNode() )->Parent() );
		*storedHandle = parent;
		level--;
	}else{
		*storedHandle = TiXmlHandle(&doc);
		level = 0;
	}

	return level;
}

//---------------------------------------------------------
int ofxXmlSettings::getPushLevel(){
	return level;
}

//---------------------------------------------------------
bool ofxXmlSettings::tagExists(string  tag, int which){

	vector<string> tokens = tokenize(tag,":");

	bool found = false;

	//grab the handle from the level we are at
	//normally this is the doc but could be a pushed node
	TiXmlHandle tagHandle = *storedHandle;

	if(which < 0) which = 0;

	for(int x=0;x<tokens.size();x++){

		//we only support multi tags
		//with same name at root level
		if(x > 0) which = 0;

		TiXmlHandle isRealHandle = tagHandle.ChildElement( tokens.at(x), which);

		//as soon as we find a tag that doesn't exist
		//we return false;
		if ( !isRealHandle.Node() ){
			found = false;
			break;
		}
		else{
			found = true;
			tagHandle = isRealHandle;
		}
	}

	tokens.clear();

	return found;
}

//---------------------------------------------------------
int ofxXmlSettings::getNumTags(string  tag){
	//this only works for tags at the current root level

	int pos = tag.find(":");

	if(pos > 0){
		tag = tag.substr(0,pos);
	}

	//grab the handle from the level we are at
	//normally this is the doc but could be a pushed node
	TiXmlHandle tagHandle = *storedHandle;

	int count = 0;

	//ripped from tinyXML as doing this ourselves once is a LOT! faster
	//than having this called n number of times in a while loop - we go from n*n iterations to n iterations

	TiXmlElement* child = ( storedHandle->FirstChildElement( tag ) ).Element();
	for (count = 0; child; child = child->NextSiblingElement( tag ), ++count){
		//nothing
	}

	return count;
}

//---------------------------------------------------------
int ofxXmlSettings::writeTag(string  tag, char * valueStr, int which){

	vector<string> tokens = tokenize(tag,":");

	// allocate then clean up :
	TiXmlElement ** elements = new TiXmlElement*[tokens.size()];
	for(int x=0;x<tokens.size();x++){
		elements[x] = new TiXmlElement(tokens.at(x));
	}

	TiXmlText Value(valueStr);

	// search our way up - do these tags exist?
	// find the first that DOESNT exist, then move backwards...
	TiXmlHandle tagHandle = *storedHandle;

	bool addNewTag = false;
	if(which == -1)addNewTag = true;

	for(int x=0;x<tokens.size();x++){

		if( x > 0 ){
			//multi tags of same name
			//only for the root level
			which = 0;
			addNewTag = false;
		}

		TiXmlHandle isRealHandle = tagHandle.ChildElement( tokens.at(x), which);

		if ( !isRealHandle.Node() ||  addNewTag){

			for(int i=tokens.size()-1;i>=x;i--){
				if (i == tokens.size()-1){
					elements[i]->InsertEndChild(Value);
				} else {
					elements[i]->InsertEndChild(*(elements[i+1]));
				}
			}

			tagHandle.ToNode()->InsertEndChild(*(elements[x]));

			break;

		} else {
			 tagHandle = isRealHandle;
			 if (x == tokens.size()-1){
				// what we want to change : TiXmlHandle valHandle = tagHandle.Child( 0 );
				tagHandle.ToNode()->Clear();
				tagHandle.ToNode()->InsertEndChild(Value);
			}
		}
	}

	//lets count how many tags with our name exist so we can return an index

	//ripped from tinyXML as doing this ourselves once is a LOT! faster
	//than having this called n number of times in a while loop - we go from n*n iterations to n iterations
	int numSameTags;
	TiXmlElement* child = ( storedHandle->FirstChildElement( tokens.at(0) ) ).Element();
	for (numSameTags = 0; child; child = child->NextSiblingElement( tokens.at(0) ), ++numSameTags){
		//nothing
	}

	//now, clear that vector!
	tokens.clear();

	return numSameTags;
}

//---------------------------------------------------------
int ofxXmlSettings::setValue(string tag, int value, int which){
	char valueStr[255];
	sprintf(valueStr, "%i", value);
	int tagID = writeTag(tag, valueStr, which) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::setValue(string  tag, double value, int which){
	char valueStr[255];
	sprintf(valueStr, "%f", value);
	int tagID = writeTag(tag, valueStr, which) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::setValue(string tag, string value, int which){
	int tagID = writeTag(tag, (char *)value.c_str(), which) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addValue(string tag, int value){
	char valueStr[255];
	sprintf(valueStr, "%i", value);
	int tagID = writeTag(tag, valueStr, -1) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addValue(string  tag, double value){
	char valueStr[255];
	sprintf(valueStr, "%f", value);
	int tagID = writeTag(tag, valueStr, -1) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addValue(string tag, string value){
	int tagID = writeTag(tag, (char *)value.c_str(), -1) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addTag(string tag){
	int tagID = writeTag(tag, "", -1) -1;
	return tagID;
}
<commit_msg>getting rid of some warnings by casting size of vectors to int<commit_after>#include "ofxXmlSettings.h"

#include <vector>
#include <string>
#include <iostream>

//----------------------------------------
// a pretty useful tokenization system:
static vector<string> tokenize(const string & str, const string & delim);
static vector<string> tokenize(const string & str, const string & delim)
{
  vector<string> tokens;

  size_t p0 = 0, p1 = string::npos;
  while(p0 != string::npos)
  {
    p1 = str.find_first_of(delim, p0);
    if(p1 != p0)
    {
      string token = str.substr(p0, p1 - p0);
      tokens.push_back(token);
    }
    p0 = str.find_first_not_of(delim, p1);
  }
  return tokens;
}
//----------------------------------------

ofxXmlSettings::ofxXmlSettings(){
	storedHandle	= new TiXmlHandle(NULL);
	level			= 0;
	//we do this so that we have a valid handle
	//without the need for loadFile
	*storedHandle   = TiXmlHandle(&doc);
}

//---------------------------------------------------------
void ofxXmlSettings::setVerbose(bool _verbose){
}

//---------------------------------------------------------
void ofxXmlSettings::clear(){
	//we clear from our root level
	//this is usually the document
	//but if we are pushed  - it could
	//be all the tags inside of the pushed
	//node - including the node itself!

	storedHandle->ToNode()->Clear();
}

//---------------------------------------------------------
bool ofxXmlSettings::loadFile(string xmlFile){

	xmlFile = ofToDataPath(xmlFile);

	bool loadOkay = doc.LoadFile(xmlFile.c_str());

	//theo removed bool check as it would
	//return false if the file exists but was
	//empty

    //our push pop level should be set to 0!
	level = 0;

	*storedHandle = TiXmlHandle(&doc);
	return loadOkay;
}

//---------------------------------------------------------
void ofxXmlSettings::saveFile(string xmlFile){

	xmlFile = ofToDataPath(xmlFile);
	doc.SaveFile(xmlFile.c_str());
}

//---------------------------------------------------------
void ofxXmlSettings::clearTagContents(string tag, int which){
	//we check it first to see if it exists
	//otherwise setValue will make a new empty tag
	if( tagExists(tag, which) )setValue(tag, "", which);
}

//---------------------------------------------------------
void ofxXmlSettings::removeTag(string  tag, int which){

	vector<string> tokens = tokenize(tag,":");

	//no tags so we return
	if( tokens.size() == 0 ) return;

	//grab the handle from the level we are at
	//normally this is the doc but could be a pushed node
	TiXmlHandle tagHandle = *storedHandle;

	if(which < 0) which = 0;

	for(int x=0;x<(int)tokens.size();x++){

		//we only support multi tags
		//with same name at root level
		if(x > 0) which = 0;

		TiXmlHandle isRealHandle = tagHandle.ChildElement( tokens.at(x), which);

		if ( !isRealHandle.Node() ) break;
		else{
			if (x == (int)tokens.size()-1){
				//if we are at the last tag and it exists
				//we use its parent to remove it - haha
				tagHandle.ToNode()->RemoveChild( isRealHandle.ToNode() );
			}
			tagHandle = isRealHandle;
		}
	}

	tokens.clear();
}

//---------------------------------------------------------
int ofxXmlSettings::getValue(string tag, int defaultValue, int which){
	char * tempStr = new char[MAX_TAG_VALUE_LENGTH_IN_CHARS];
	memset(tempStr, 0, MAX_TAG_VALUE_LENGTH_IN_CHARS);
	int returnValue = defaultValue;

	if (readTag(tag, tempStr, which)){
		returnValue = strtol(tempStr, NULL, 0);
	}
	delete tempStr;
	return returnValue;
}

//---------------------------------------------------------
float ofxXmlSettings::getValue(string tag, double defaultValue, int which){
	char * tempStr = new char[MAX_TAG_VALUE_LENGTH_IN_CHARS];
	memset(tempStr, 0, MAX_TAG_VALUE_LENGTH_IN_CHARS);
	float returnValue = defaultValue;

	if (readTag(tag, tempStr, which)){
		returnValue = strtod(tempStr,  NULL);
	}
	delete tempStr;
	return returnValue;
}

//---------------------------------------------------------
string ofxXmlSettings::getValue(string tag, string defaultValue, int which){

	// lots of char *, string kung-fu here...

	char * tempStr = new char[MAX_TAG_VALUE_LENGTH_IN_CHARS];
	memset(tempStr, 0, MAX_TAG_VALUE_LENGTH_IN_CHARS);
	char * returnPtr = (char *) defaultValue.c_str();
	if (readTag(tag, tempStr, which)){
		returnPtr = tempStr;
	}
	string returnString(returnPtr);
	delete tempStr;
	return returnString;
}

//---------------------------------------------------------
bool ofxXmlSettings::readTag(string  tag, char * valueString, int which){

	vector<string> tokens = tokenize(tag,":");

	TiXmlHandle tagHandle = *storedHandle;
	for(int x=0;x<(int)tokens.size();x++){
		if(x == 0)tagHandle = tagHandle.ChildElement(tokens.at(x), which);
		else tagHandle = tagHandle.FirstChildElement( tokens.at(x) );
	}

	// once we've walked, let's get that value...
	TiXmlHandle valHandle = tagHandle.Child( 0 );

    //now, clear that vector!
	tokens.clear();

    // if that value is really text, let's get the value out of it !
    if (valHandle.Text()){
    	int maxLen = MIN(MAX_TAG_VALUE_LENGTH_IN_CHARS, strlen(valHandle.Text()->Value()));
    	memcpy(valueString, valHandle.Text()->Value(), maxLen);
    	return true;
    }  else {
		return false;
	}
}

//---------------------------------------------------------
bool ofxXmlSettings::pushTag(string  tag, int which){

	int pos = tag.find(":");

	if(pos > 0){
		tag = tag.substr(0,pos);
	}

	//we only allow to push one tag at a time.
	TiXmlHandle isRealHandle = storedHandle->ChildElement(tag, which);

	if( isRealHandle.Node() ){
		*storedHandle = isRealHandle;
		level++;
		return true;
	}else{
		printf("pushTag - tag not found\n");
	}

	return false;
}

//---------------------------------------------------------
int ofxXmlSettings::popTag(){

	if(level >= 1){
		TiXmlHandle parent( (storedHandle->ToNode() )->Parent() );
		*storedHandle = parent;
		level--;
	}else{
		*storedHandle = TiXmlHandle(&doc);
		level = 0;
	}

	return level;
}

//---------------------------------------------------------
int ofxXmlSettings::getPushLevel(){
	return level;
}

//---------------------------------------------------------
bool ofxXmlSettings::tagExists(string  tag, int which){

	vector<string> tokens = tokenize(tag,":");

	bool found = false;

	//grab the handle from the level we are at
	//normally this is the doc but could be a pushed node
	TiXmlHandle tagHandle = *storedHandle;

	if(which < 0) which = 0;

	for(int x=0;x<(int)tokens.size();x++){

		//we only support multi tags
		//with same name at root level
		if(x > 0) which = 0;

		TiXmlHandle isRealHandle = tagHandle.ChildElement( tokens.at(x), which);

		//as soon as we find a tag that doesn't exist
		//we return false;
		if ( !isRealHandle.Node() ){
			found = false;
			break;
		}
		else{
			found = true;
			tagHandle = isRealHandle;
		}
	}

	tokens.clear();

	return found;
}

//---------------------------------------------------------
int ofxXmlSettings::getNumTags(string  tag){
	//this only works for tags at the current root level

	int pos = tag.find(":");

	if(pos > 0){
		tag = tag.substr(0,pos);
	}

	//grab the handle from the level we are at
	//normally this is the doc but could be a pushed node
	TiXmlHandle tagHandle = *storedHandle;

	int count = 0;

	//ripped from tinyXML as doing this ourselves once is a LOT! faster
	//than having this called n number of times in a while loop - we go from n*n iterations to n iterations

	TiXmlElement* child = ( storedHandle->FirstChildElement( tag ) ).Element();
	for (count = 0; child; child = child->NextSiblingElement( tag ), ++count){
		//nothing
	}

	return count;
}

//---------------------------------------------------------
int ofxXmlSettings::writeTag(string  tag, char * valueStr, int which){

	vector<string> tokens = tokenize(tag,":");

	// allocate then clean up :
	TiXmlElement ** elements = new TiXmlElement*[tokens.size()];
	for(int x=0;x<(int)tokens.size();x++){
		elements[x] = new TiXmlElement(tokens.at(x));
	}

	TiXmlText Value(valueStr);

	// search our way up - do these tags exist?
	// find the first that DOESNT exist, then move backwards...
	TiXmlHandle tagHandle = *storedHandle;

	bool addNewTag = false;
	if(which == -1)addNewTag = true;

	for(int x=0;x<(int)tokens.size();x++){

		if( x > 0 ){
			//multi tags of same name
			//only for the root level
			which = 0;
			addNewTag = false;
		}

		TiXmlHandle isRealHandle = tagHandle.ChildElement( tokens.at(x), which);

		if ( !isRealHandle.Node() ||  addNewTag){

			for(int i=tokens.size()-1;i>=x;i--){
				if (i == (int)tokens.size()-1){
					elements[i]->InsertEndChild(Value);
				} else {
					elements[i]->InsertEndChild(*(elements[i+1]));
				}
			}

			tagHandle.ToNode()->InsertEndChild(*(elements[x]));

			break;

		} else {
			 tagHandle = isRealHandle;
			 if (x == (int)tokens.size()-1){
				// what we want to change : TiXmlHandle valHandle = tagHandle.Child( 0 );
				tagHandle.ToNode()->Clear();
				tagHandle.ToNode()->InsertEndChild(Value);
			}
		}
	}

	//lets count how many tags with our name exist so we can return an index

	//ripped from tinyXML as doing this ourselves once is a LOT! faster
	//than having this called n number of times in a while loop - we go from n*n iterations to n iterations
	int numSameTags;
	TiXmlElement* child = ( storedHandle->FirstChildElement( tokens.at(0) ) ).Element();
	for (numSameTags = 0; child; child = child->NextSiblingElement( tokens.at(0) ), ++numSameTags){
		//nothing
	}

	//now, clear that vector!
	tokens.clear();

	return numSameTags;
}

//---------------------------------------------------------
int ofxXmlSettings::setValue(string tag, int value, int which){
	char valueStr[255];
	sprintf(valueStr, "%i", value);
	int tagID = writeTag(tag, valueStr, which) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::setValue(string  tag, double value, int which){
	char valueStr[255];
	sprintf(valueStr, "%f", value);
	int tagID = writeTag(tag, valueStr, which) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::setValue(string tag, string value, int which){
	int tagID = writeTag(tag, (char *)value.c_str(), which) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addValue(string tag, int value){
	char valueStr[255];
	sprintf(valueStr, "%i", value);
	int tagID = writeTag(tag, valueStr, -1) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addValue(string  tag, double value){
	char valueStr[255];
	sprintf(valueStr, "%f", value);
	int tagID = writeTag(tag, valueStr, -1) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addValue(string tag, string value){
	int tagID = writeTag(tag, (char *)value.c_str(), -1) -1;
	return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addTag(string tag){
	int tagID = writeTag(tag, "", -1) -1;
	return tagID;
}
<|endoftext|>


<commit_before>// This file is a part of the IncludeOS unikernel - www.includeos.org
//
// Copyright 2015 Oslo and Akershus University College of Applied Sciences
// and Alfred Bratterud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <service>
#include <net/interfaces>
#include <net/router.hpp>
using namespace net;

static std::unique_ptr<Router<IP6>> router;

static bool
route_checker(IP6::addr addr)
{
  INFO("Route checker", "asked for route to IP %s", addr.to_string().c_str());

  bool have_route = router->route_check(addr);

  INFO("Route checker", "The router says %i", have_route);

  if (have_route)
    INFO2("* Responding YES");
  else
    INFO2("* Responding NO");

  return have_route;
}

static void
ip_forward (IP6::IP_packet_ptr pckt, Inet& stack, Conntrack::Entry_ptr)
{
  Inet* route = router->get_first_interface(pckt->ip_dst());

  if (not route){
    INFO("ip_fwd", "No route found for %s dropping\n", pckt->ip_dst().to_string().c_str());
    return;
  }

  if (route == &stack) {
    INFO("ip_fwd", "* Oh, this packet was for me, so why was it forwarded here? \n");
    return;
  }

  debug("[ ip_fwd ] %s transmitting packet to %s",stack.ifname().c_str(), route->ifname().c_str());
  route->ip6_obj().ship(std::move(pckt));
}

void Service::start(const std::string&)
{
  auto& inet = Interfaces::get(0);
  inet.network_config6({ 0xfe80, 0, 0, 0, 0xe823, 0xfcff, 0xfef4, 0x85cd },    // IP
                      112,                                                      // Prefix6
                      { 0xfe80,  0,  0, 0, 0xe823, 0xfcff, 0xfef4, 0x83e7 });  // Gateway

  INFO("Router","Interface 1 IP: %s\n", inet.ip6_addr().str().c_str());

  auto& inet2 = Interfaces::get(1);
  inet2.network_config6({ 0xfe80, 0, 0, 0, 0xabcd, 0xabcd, 0x1234, 0x5678 },  // IP
                      112,                                                   // Prefix6
                      { 0xfe80, 0, 0, 0, 0xabcd, 0xabcd, 0x1234, 0x8367}); // Gateway

  INFO("Router","Interface2 IP: %s\n", inet2.ip6_addr().str().c_str());

  // IP Forwarding
  inet.ip6_obj().set_packet_forwarding(ip_forward);
  inet2.ip6_obj().set_packet_forwarding(ip_forward);

  // NDP Route checker
  inet.set_route_checker6(route_checker);
  inet2.set_route_checker6(route_checker);

  // Routing table
  Router<IP6>::Routing_table routing_table{
    {{0xfe80, 0, 0, 0, 0xabcd, 0xabcd, 0x1234, 0 }, 112,
    {0xfe80, 0, 0, 0, 0xabcd, 0xabcd, 0x1234, 0x8367}, inet2 , 1 },
    {{ 0xfe80,  0,  0, 0, 0xe823, 0xfcff, 0xfef4, 0}, 112,
    {0xfe80,  0,  0, 0, 0xe823, 0xfcff, 0xfef4, 0x83e7}, inet , 1 }
  };

  router = std::make_unique<Router<IP6>>(routing_table);

  INFO("Router", "Routing enabled - routing table:");

  for (auto r : routing_table)
    INFO2("* %s/%i -> %s / %s, cost %i", r.net().str().c_str(),
          __builtin_popcount(r.netmask()),
          r.interface()->ifname().c_str(),
          r.nexthop().to_string().c_str(),
          r.cost());
  printf("\n");
  INFO("Router","Service ready");
}
<commit_msg>test: Use correct way to configure network in router6<commit_after>// This file is a part of the IncludeOS unikernel - www.includeos.org
//
// Copyright 2015 Oslo and Akershus University College of Applied Sciences
// and Alfred Bratterud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <service>
#include <net/interfaces>
#include <net/router.hpp>
using namespace net;

static std::unique_ptr<Router<IP6>> router;

static bool
route_checker(IP6::addr addr)
{
  INFO("Route checker", "asked for route to IP %s", addr.to_string().c_str());

  bool have_route = router->route_check(addr);

  INFO("Route checker", "The router says %i", have_route);

  if (have_route)
    INFO2("* Responding YES");
  else
    INFO2("* Responding NO");

  return have_route;
}

static void
ip_forward (IP6::IP_packet_ptr pckt, Inet& stack, Conntrack::Entry_ptr)
{
  Inet* route = router->get_first_interface(pckt->ip_dst());

  if (not route){
    INFO("ip_fwd", "No route found for %s dropping\n", pckt->ip_dst().to_string().c_str());
    return;
  }

  if (route == &stack) {
    INFO("ip_fwd", "* Oh, this packet was for me, so why was it forwarded here? \n");
    return;
  }

  debug("[ ip_fwd ] %s transmitting packet to %s",stack.ifname().c_str(), route->ifname().c_str());
  route->ip6_obj().ship(std::move(pckt));
}

void Service::start(const std::string&)
{
  auto& inet = Interfaces::get(0);
  inet.add_addr({"fe80::e823:fcff:fef4:85cd"}, 112);
  //inet.ndp().add_router({"fe80::e823:fcff:fef4:83e7"}, 0xffff);

  INFO("Router","Interface 1 IP: %s\n", inet.ip6_addr().str().c_str());

  auto& inet2 = Interfaces::get(1);
  inet2.add_addr({"fe80::abcd:abcd:1234:5678"}, 112);
  //inet2.ndp().add_router({"fe80::abcd:abcd:1234:8367"}, 0xffff);

  INFO("Router","Interface2 IP: %s\n", inet2.ip6_addr().str().c_str());

  // IP Forwarding
  inet.ip6_obj().set_packet_forwarding(ip_forward);
  inet2.ip6_obj().set_packet_forwarding(ip_forward);

  // NDP Route checker
  inet.set_route_checker6(route_checker);
  inet2.set_route_checker6(route_checker);

  // Routing table
  Router<IP6>::Routing_table routing_table{
    {{0xfe80, 0, 0, 0, 0xabcd, 0xabcd, 0x1234, 0 }, 112,
    {0xfe80, 0, 0, 0, 0xabcd, 0xabcd, 0x1234, 0x8367}, inet2 , 1 },
    {{ 0xfe80,  0,  0, 0, 0xe823, 0xfcff, 0xfef4, 0}, 112,
    {0xfe80,  0,  0, 0, 0xe823, 0xfcff, 0xfef4, 0x83e7}, inet , 1 }
  };

  router = std::make_unique<Router<IP6>>(routing_table);

  INFO("Router", "Routing enabled - routing table:");

  for (auto r : routing_table)
    INFO2("* %s/%i -> %s / %s, cost %i", r.net().str().c_str(),
          __builtin_popcount(r.netmask()),
          r.interface()->ifname().c_str(),
          r.nexthop().to_string().c_str(),
          r.cost());
  printf("\n");
  INFO("Router","Service ready");
}
<|endoftext|>


<commit_before>#include <assert.h>
#include "lms7002_mainPanel.h"
#include "lms7002_pnlAFE_view.h"
#include "lms7002_pnlBIAS_view.h"
#include "lms7002_pnlBIST_view.h"
#include "lms7002_pnlCDS_view.h"
#include "lms7002_pnlCLKGEN_view.h"
#include "lms7002_pnlLDO_view.h"
#include "lms7002_pnlLimeLightPAD_view.h"
#include "lms7002_pnlTxTSP_view.h"
#include "lms7002_pnlRxTSP_view.h"
#include "lms7002_pnlRBB_view.h"
#include "lms7002_pnlRFE_view.h"
#include "lms7002_pnlSX_view.h"
#include "lms7002_pnlTBB_view.h"
#include "lms7002_pnlTRF_view.h"
#include "lms7002_pnlXBUF_view.h"
#include "lms7002_pnlCalibrations_view.h"
#include "LMS7002M.h"
#include "ErrorReporting.h"
#include <wx/time.h>
#include <wx/msgdlg.h>
#include <iostream>
#include <wx/filedlg.h>
#include "lms7suiteEvents.h"
#include "lms7002_pnlMCU_BD_view.h"
#include "lms7002_pnlBuffers_view.h"
using namespace std;
using namespace lime;

lms7002_mainPanel::lms7002_mainPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
    :
    mainPanel(parent, id, pos, size, style), lmsControl(nullptr)
{
    mTabMCU = new lms7002_pnlMCU_BD_view(tabsNotebook);
    tabsNotebook->AddPage(mTabMCU, _("MCU"));
}

lms7002_mainPanel::~lms7002_mainPanel()
{
}

void lms7002_mainPanel::UpdateVisiblePanel()
{
    wxLongLong t1, t2;
    t1 = wxGetUTCTimeMillis();
    long visibleTabId = tabsNotebook->GetCurrentPage()->GetId();
    switch (visibleTabId)
    {
    case ID_TAB_AFE:
        mTabAFE->UpdateGUI();
        break;
    case ID_TAB_BIAS:
        mTabBIAS->UpdateGUI();
        break;
    case ID_TAB_BIST:
        mTabBIST->UpdateGUI();
        break;
    case ID_TAB_CDS:
        mTabCDS->UpdateGUI();
        break;
    case ID_TAB_CGEN:
        mTabCGEN->UpdateGUI();
        break;
    case ID_TAB_LDO:
        mTabLDO->UpdateGUI();
        break;
    case ID_TAB_LIMELIGHT:
        mTabLimeLight->UpdateGUI();
        break;
    case ID_TAB_TXTSP:
        mTabTxTSP->UpdateGUI();
        break;
    case ID_TAB_RXTSP:
        mTabRxTSP->UpdateGUI();
        break;
    case ID_TAB_RBB:
        mTabRBB->UpdateGUI();
        break;
    case ID_TAB_RFE:
        mTabRFE->UpdateGUI();
        break;
    case ID_TAB_SXR:
        mTabSXR->UpdateGUI();
        break;
    case ID_TAB_SXT:
        mTabSXT->UpdateGUI();
        break;
    case ID_TAB_TBB:
        mTabTBB->UpdateGUI();
        break;
    case ID_TAB_TRF:
        mTabTRF->UpdateGUI();
        break;
    case ID_TAB_XBUF:
        mTabXBUF->UpdateGUI();
        break;
    case ID_TAB_CALIBRATIONS:
        mTabCalibrations->UpdateGUI();
        break;
    case ID_TAB_BUFFERS:
        mTabBuffers->UpdateGUI();
        break;
    }
    t2 = wxGetUTCTimeMillis();
#ifndef NDEBUG
    cout << "Visible GUI update time: " << (t2 - t1).ToString() << endl;
#endif
}

void lms7002_mainPanel::Initialize(LMS7002M* pControl)
{
    assert(pControl != nullptr);
    lmsControl = pControl;
    mTabRFE->Initialize(lmsControl);
    mTabRBB->Initialize(lmsControl);
    mTabTRF->Initialize(lmsControl);
    mTabTBB->Initialize(lmsControl);
    mTabAFE->Initialize(lmsControl);
    mTabBIAS->Initialize(lmsControl);
    mTabLDO->Initialize(lmsControl);
    mTabXBUF->Initialize(lmsControl);
    mTabCGEN->Initialize(lmsControl);
    mTabSXR->Initialize(lmsControl);
    mTabSXT->Initialize(lmsControl);
    mTabLimeLight->Initialize(lmsControl);
    mTabTxTSP->Initialize(lmsControl);
    mTabRxTSP->Initialize(lmsControl);
    mTabCDS->Initialize(lmsControl);
    mTabBIST->Initialize(lmsControl);
    mTabCalibrations->Initialize(lmsControl);
    mTabMCU->Initialize(lmsControl->GetMCUControls());
// TODO setup buffers gui
    //mTabBuffers->Initialize(lmsControl->GetControlPort());
    UpdateGUI();
}

void lms7002_mainPanel::OnResetChip(wxCommandEvent &event)
{
    int status = lmsControl->ResetChip();
    if (status != 0)
        wxMessageBox(wxString::Format(_("Chip reset: %s"), wxString::From8BitData(GetLastErrorMessage())), _("Warning"));
    wxNotebookEvent evt;
    Onnotebook_modulesPageChanged(evt); //after reset chip active channel might change, this refresh channel for active tab
}

void lms7002_mainPanel::UpdateGUI()
{
    wxLongLong t1, t2;
    t1 = wxGetUTCTimeMillis();
    lmsControl->IsSynced();
    t2 = wxGetUTCTimeMillis();
    LMS7002M::Channel channel = lmsControl->GetActiveChannel();
    if (channel == LMS7002M::ChA)
    {
        rbChannelA->SetValue(true);
        rbChannelB->SetValue(false);
    }
    else if (channel == LMS7002M::ChB)
    {
        rbChannelA->SetValue(false);
        rbChannelB->SetValue(true);
    }
    else
    {
        lmsControl->SetActiveChannel(LMS7002M::ChA);
        rbChannelA->SetValue(true);
        rbChannelB->SetValue(false);
    }

    UpdateVisiblePanel();
#ifndef NDEBUG
    cout << "GUI update time: " << (t2 - t1).ToString() << endl;
#endif
}

void lms7002_mainPanel::OnNewProject( wxCommandEvent& event )
{
    lmsControl->ResetChip();
    lmsControl->DownloadAll();
    lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB);
    UpdateGUI();
}

void lms7002_mainPanel::OnOpenProject( wxCommandEvent& event )
{
    wxFileDialog dlg(this, _("Open config file"), "", "", "Project-File (*.ini)|*.ini", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
    if (dlg.ShowModal() == wxID_CANCEL)
        return;
    int status = lmsControl->LoadConfig(dlg.GetPath().To8BitData());
    if (status != 0)
    {
        if (lmsControl->GetConnection() == nullptr)
            wxMessageBox(wxString::Format(_("Failed to load file: %s"), GetLastErrorMessage()), _("Warning"));
    }
    wxCommandEvent tevt;
    lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB);
    UpdateGUI();
    wxCommandEvent evt;
    evt.SetEventType(CGEN_FREQUENCY_CHANGED);
    wxPostEvent(this, evt);
}

void lms7002_mainPanel::OnSaveProject( wxCommandEvent& event )
{
    wxFileDialog dlg(this, _("Save config file"), "", "", "Project-File (*.ini)|*.ini", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
    if (dlg.ShowModal() == wxID_CANCEL)
        return;
    int status = lmsControl->SaveConfig(dlg.GetPath().To8BitData());
    if (status != 0)
        wxMessageBox(_("Failed to save file"), _("Warning"));
}

void lms7002_mainPanel::OnRegistersTest( wxCommandEvent& event )
{
    int status = lmsControl->RegistersTest();
    if (status != 0)
        wxMessageBox(_("Registers test failed!"), _("WARNING"));
    else
        wxMessageBox(_("Registers test passed!"), _("INFO"));
}

void lms7002_mainPanel::OnSwitchToChannelA(wxCommandEvent& event)
{
    lmsControl->SetActiveChannel(LMS7002M::ChA);
    UpdateVisiblePanel();
}

void lms7002_mainPanel::OnSwitchToChannelB(wxCommandEvent& event)
{
    lmsControl->SetActiveChannel(LMS7002M::ChB);
    UpdateVisiblePanel();
}

void lms7002_mainPanel::Onnotebook_modulesPageChanged( wxNotebookEvent& event )
{
    wxNotebookPage* page = tabsNotebook->GetCurrentPage();
    if (page == mTabAFE || page == mTabBIAS || page == mTabLDO || page == mTabXBUF || page == mTabCGEN || page == mTabCDS || page == mTabBIST)
    {
        rbChannelA->Disable();
        rbChannelB->Disable();
    }
    else if (page == mTabSXR) //change active channel to A
    {
        lmsControl->SetActiveChannel(LMS7002M::ChA);
        rbChannelA->Disable();
        rbChannelB->Disable();
    }
    else if (page == mTabSXT) //change active channel to B
    {
        lmsControl->SetActiveChannel(LMS7002M::ChB);
        rbChannelA->Disable();
        rbChannelB->Disable();
    }
    else
    {
        lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB);
        rbChannelA->Enable();
        rbChannelB->Enable();
    }
    UpdateVisiblePanel();
}

void lms7002_mainPanel::OnDownloadAll(wxCommandEvent& event)
{
    int status = lmsControl->DownloadAll();
    if (status != 0)
        wxMessageBox(wxString::Format(_("Download all registers: %s"), wxString::From8BitData(GetLastErrorMessage())), _("Warning"));
    UpdateVisiblePanel();
}

void lms7002_mainPanel::OnUploadAll(wxCommandEvent& event)
{
    int status = lmsControl->UploadAll();
    if (status != 0)
        wxMessageBox(wxString::Format(_("Upload all registers: %s"), wxString::From8BitData(GetLastErrorMessage())), _("Warning"));
    wxCommandEvent evt;
    evt.SetEventType(CGEN_FREQUENCY_CHANGED);
    wxPostEvent(this, evt);
    UpdateVisiblePanel();
}
<commit_msg>fix notebook page show on osx<commit_after>#include <assert.h>
#include "lms7002_mainPanel.h"
#include "lms7002_pnlAFE_view.h"
#include "lms7002_pnlBIAS_view.h"
#include "lms7002_pnlBIST_view.h"
#include "lms7002_pnlCDS_view.h"
#include "lms7002_pnlCLKGEN_view.h"
#include "lms7002_pnlLDO_view.h"
#include "lms7002_pnlLimeLightPAD_view.h"
#include "lms7002_pnlTxTSP_view.h"
#include "lms7002_pnlRxTSP_view.h"
#include "lms7002_pnlRBB_view.h"
#include "lms7002_pnlRFE_view.h"
#include "lms7002_pnlSX_view.h"
#include "lms7002_pnlTBB_view.h"
#include "lms7002_pnlTRF_view.h"
#include "lms7002_pnlXBUF_view.h"
#include "lms7002_pnlCalibrations_view.h"
#include "LMS7002M.h"
#include "ErrorReporting.h"
#include <wx/time.h>
#include <wx/msgdlg.h>
#include <iostream>
#include <wx/filedlg.h>
#include "lms7suiteEvents.h"
#include "lms7002_pnlMCU_BD_view.h"
#include "lms7002_pnlBuffers_view.h"
using namespace std;
using namespace lime;

lms7002_mainPanel::lms7002_mainPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
    :
    mainPanel(parent, id, pos, size, style), lmsControl(nullptr)
{
    mTabMCU = new lms7002_pnlMCU_BD_view(tabsNotebook);
    tabsNotebook->AddPage(mTabMCU, _("MCU"));
}

lms7002_mainPanel::~lms7002_mainPanel()
{
}

void lms7002_mainPanel::UpdateVisiblePanel()
{
    wxLongLong t1, t2;
    t1 = wxGetUTCTimeMillis();
    long visibleTabId = tabsNotebook->GetCurrentPage()->GetId();
    switch (visibleTabId)
    {
    case ID_TAB_AFE:
        mTabAFE->UpdateGUI();
        break;
    case ID_TAB_BIAS:
        mTabBIAS->UpdateGUI();
        break;
    case ID_TAB_BIST:
        mTabBIST->UpdateGUI();
        break;
    case ID_TAB_CDS:
        mTabCDS->UpdateGUI();
        break;
    case ID_TAB_CGEN:
        mTabCGEN->UpdateGUI();
        break;
    case ID_TAB_LDO:
        mTabLDO->UpdateGUI();
        break;
    case ID_TAB_LIMELIGHT:
        mTabLimeLight->UpdateGUI();
        break;
    case ID_TAB_TXTSP:
        mTabTxTSP->UpdateGUI();
        break;
    case ID_TAB_RXTSP:
        mTabRxTSP->UpdateGUI();
        break;
    case ID_TAB_RBB:
        mTabRBB->UpdateGUI();
        break;
    case ID_TAB_RFE:
        mTabRFE->UpdateGUI();
        break;
    case ID_TAB_SXR:
        mTabSXR->UpdateGUI();
        break;
    case ID_TAB_SXT:
        mTabSXT->UpdateGUI();
        break;
    case ID_TAB_TBB:
        mTabTBB->UpdateGUI();
        break;
    case ID_TAB_TRF:
        mTabTRF->UpdateGUI();
        break;
    case ID_TAB_XBUF:
        mTabXBUF->UpdateGUI();
        break;
    case ID_TAB_CALIBRATIONS:
        mTabCalibrations->UpdateGUI();
        break;
    case ID_TAB_BUFFERS:
        mTabBuffers->UpdateGUI();
        break;
    }
    t2 = wxGetUTCTimeMillis();
#ifndef NDEBUG
    cout << "Visible GUI update time: " << (t2 - t1).ToString() << endl;
#endif
}

void lms7002_mainPanel::Initialize(LMS7002M* pControl)
{
    assert(pControl != nullptr);
    lmsControl = pControl;
    mTabRFE->Initialize(lmsControl);
    mTabRBB->Initialize(lmsControl);
    mTabTRF->Initialize(lmsControl);
    mTabTBB->Initialize(lmsControl);
    mTabAFE->Initialize(lmsControl);
    mTabBIAS->Initialize(lmsControl);
    mTabLDO->Initialize(lmsControl);
    mTabXBUF->Initialize(lmsControl);
    mTabCGEN->Initialize(lmsControl);
    mTabSXR->Initialize(lmsControl);
    mTabSXT->Initialize(lmsControl);
    mTabLimeLight->Initialize(lmsControl);
    mTabTxTSP->Initialize(lmsControl);
    mTabRxTSP->Initialize(lmsControl);
    mTabCDS->Initialize(lmsControl);
    mTabBIST->Initialize(lmsControl);
    mTabCalibrations->Initialize(lmsControl);
    mTabMCU->Initialize(lmsControl->GetMCUControls());
// TODO setup buffers gui
    //mTabBuffers->Initialize(lmsControl->GetControlPort());
    UpdateGUI();
}

void lms7002_mainPanel::OnResetChip(wxCommandEvent &event)
{
    int status = lmsControl->ResetChip();
    if (status != 0)
        wxMessageBox(wxString::Format(_("Chip reset: %s"), wxString::From8BitData(GetLastErrorMessage())), _("Warning"));
    wxNotebookEvent evt;
    Onnotebook_modulesPageChanged(evt); //after reset chip active channel might change, this refresh channel for active tab
}

void lms7002_mainPanel::UpdateGUI()
{
    wxLongLong t1, t2;
    t1 = wxGetUTCTimeMillis();
    lmsControl->IsSynced();
    t2 = wxGetUTCTimeMillis();
    LMS7002M::Channel channel = lmsControl->GetActiveChannel();
    if (channel == LMS7002M::ChA)
    {
        rbChannelA->SetValue(true);
        rbChannelB->SetValue(false);
    }
    else if (channel == LMS7002M::ChB)
    {
        rbChannelA->SetValue(false);
        rbChannelB->SetValue(true);
    }
    else
    {
        lmsControl->SetActiveChannel(LMS7002M::ChA);
        rbChannelA->SetValue(true);
        rbChannelB->SetValue(false);
    }

    UpdateVisiblePanel();
#ifndef NDEBUG
    cout << "GUI update time: " << (t2 - t1).ToString() << endl;
#endif
}

void lms7002_mainPanel::OnNewProject( wxCommandEvent& event )
{
    lmsControl->ResetChip();
    lmsControl->DownloadAll();
    lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB);
    UpdateGUI();
}

void lms7002_mainPanel::OnOpenProject( wxCommandEvent& event )
{
    wxFileDialog dlg(this, _("Open config file"), "", "", "Project-File (*.ini)|*.ini", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
    if (dlg.ShowModal() == wxID_CANCEL)
        return;
    int status = lmsControl->LoadConfig(dlg.GetPath().To8BitData());
    if (status != 0)
    {
        if (lmsControl->GetConnection() == nullptr)
            wxMessageBox(wxString::Format(_("Failed to load file: %s"), GetLastErrorMessage()), _("Warning"));
    }
    wxCommandEvent tevt;
    lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB);
    UpdateGUI();
    wxCommandEvent evt;
    evt.SetEventType(CGEN_FREQUENCY_CHANGED);
    wxPostEvent(this, evt);
}

void lms7002_mainPanel::OnSaveProject( wxCommandEvent& event )
{
    wxFileDialog dlg(this, _("Save config file"), "", "", "Project-File (*.ini)|*.ini", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
    if (dlg.ShowModal() == wxID_CANCEL)
        return;
    int status = lmsControl->SaveConfig(dlg.GetPath().To8BitData());
    if (status != 0)
        wxMessageBox(_("Failed to save file"), _("Warning"));
}

void lms7002_mainPanel::OnRegistersTest( wxCommandEvent& event )
{
    int status = lmsControl->RegistersTest();
    if (status != 0)
        wxMessageBox(_("Registers test failed!"), _("WARNING"));
    else
        wxMessageBox(_("Registers test passed!"), _("INFO"));
}

void lms7002_mainPanel::OnSwitchToChannelA(wxCommandEvent& event)
{
    lmsControl->SetActiveChannel(LMS7002M::ChA);
    UpdateVisiblePanel();
}

void lms7002_mainPanel::OnSwitchToChannelB(wxCommandEvent& event)
{
    lmsControl->SetActiveChannel(LMS7002M::ChB);
    UpdateVisiblePanel();
}

void lms7002_mainPanel::Onnotebook_modulesPageChanged( wxNotebookEvent& event )
{
    wxNotebookPage* page = tabsNotebook->GetCurrentPage();
    if (page == mTabAFE || page == mTabBIAS || page == mTabLDO || page == mTabXBUF || page == mTabCGEN || page == mTabCDS || page == mTabBIST)
    {
        rbChannelA->Disable();
        rbChannelB->Disable();
    }
    else if (page == mTabSXR) //change active channel to A
    {
        lmsControl->SetActiveChannel(LMS7002M::ChA);
        rbChannelA->Disable();
        rbChannelB->Disable();
    }
    else if (page == mTabSXT) //change active channel to B
    {
        lmsControl->SetActiveChannel(LMS7002M::ChB);
        rbChannelA->Disable();
        rbChannelB->Disable();
    }
    else
    {
        lmsControl->SetActiveChannel(rbChannelA->GetValue() == 1 ? LMS7002M::ChA : LMS7002M::ChB);
        rbChannelA->Enable();
        rbChannelB->Enable();
    }

    //force show the page selected by the event (needed on apple)
    if (event.GetSelection() != -1)
    {
        tabsNotebook->GetPage(event.GetSelection())->Show(true);
    }

    UpdateVisiblePanel();
}

void lms7002_mainPanel::OnDownloadAll(wxCommandEvent& event)
{
    int status = lmsControl->DownloadAll();
    if (status != 0)
        wxMessageBox(wxString::Format(_("Download all registers: %s"), wxString::From8BitData(GetLastErrorMessage())), _("Warning"));
    UpdateVisiblePanel();
}

void lms7002_mainPanel::OnUploadAll(wxCommandEvent& event)
{
    int status = lmsControl->UploadAll();
    if (status != 0)
        wxMessageBox(wxString::Format(_("Upload all registers: %s"), wxString::From8BitData(GetLastErrorMessage())), _("Warning"));
    wxCommandEvent evt;
    evt.SetEventType(CGEN_FREQUENCY_CHANGED);
    wxPostEvent(this, evt);
    UpdateVisiblePanel();
}
<|endoftext|>


<commit_before>/**
 * The Seeks proxy and plugin framework are part of the SEEKS project.
 * Copyright (C) 2009 Emmanuel Benazera, juban@free.fr
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "se_parser_mediawiki.h"
#include "miscutil.h"

#include <strings.h>
#include <iostream>

using sp::miscutil;

namespace seeks_plugins
{
        std::string se_parser_mediawiki::_mediawiki_stupid[2] =
        { "Document title", "Titre du document / Document title" };

        se_parser_mediawiki::se_parser_mediawiki()
                :se_parser(),_li_sr_flag(false),_a_sr_flag(false),_search_result(false),_end_search(false)
        {
        }

        se_parser_mediawiki::~se_parser_mediawiki()
        {
        }

        void se_parser_mediawiki::start_element(parser_context *pc,
                        const xmlChar *name,
                        const xmlChar **attributes)
        {
                const char *tag = (const char*)name;

                if (strcasecmp(tag, "ul") == 0)
                {
                        const char *a_class = se_parser::get_attribute((const char**)attributes, "class");
                        if (a_class && strcasecmp(a_class, "mw-search-results") == 0)
                        {
                                std::cout << "[START]" << std::endl;
                                _end_search = false;
                        }
                }
                if (!_end_search && strcasecmp(tag, "li") == 0)
                {
                        std::cout << "
" << std::endl;
                        _li_sr_flag = true;

                        // create new snippet.
                        search_snippet *sp = new search_snippet(_count + 1);
                        _count++;
                        sp->_engine |= std::bitset<NSEs>(SE_MEDIAWIKI);
                        pc->_current_snippet = sp;
                }
                if (!_end_search && strcasecmp(tag, "a") == 0 && _li_sr_flag)
                {
                        std::cout << "" << std::endl;
                        const char *a_link = se_parser::get_attribute((const char**)attributes,"href");
                        _link = std::string(a_link);
                        _a_sr_flag = true;

                        if (pc->_snippets->empty())
                                _results_flag = true;
                }
                if (!_end_search && _li_sr_flag && strcasecmp(tag, "div") == 0)
                {
                        const char *a_link = se_parser::get_attribute((const char**)attributes,"class");
                        if (strcasecmp(a_link, "searchresult") == 0)
                        {
                                std::cout << "
" << std::endl;
                                _search_result = true;
                        }
                }
        }

        void se_parser_mediawiki::characters(parser_context *pc,
                        const xmlChar *chars,
                        int length)
        {
                handle_characters(pc, chars, length);
        }

        void se_parser_mediawiki::cdata(parser_context *pc,
                        const xmlChar *chars,
                        int length)
        {
                handle_characters(pc, chars, length);
        }

        void se_parser_mediawiki::handle_characters(parser_context *pc,
                        const xmlChar *chars,
                        int length)
        {
                if (_a_sr_flag)
                {
                        std::string a_chars = std::string((char*)chars);
                        miscutil::replace_in_string(a_chars,"\n"," ");
                        miscutil::replace_in_string(a_chars,"\r"," ");
                        miscutil::replace_in_string(a_chars,"-"," ");
                        _title += a_chars;
                        std::cout << _title << std::endl;
                }
                if (_search_result)
                {
                        std::string a_chars = std::string((char*)chars);
                        miscutil::replace_in_string(a_chars,"\n"," ");
                        miscutil::replace_in_string(a_chars,"\r"," ");
                        miscutil::replace_in_string(a_chars,"-"," ");
                        _summary += a_chars;
                        std::cout << _summary << std::endl;
                }
        }

        void se_parser_mediawiki::end_element(parser_context *pc,
                        const xmlChar *name)
        {
                const char *tag = (const char*) name;

                if (!_end_search && strcasecmp(tag, "ul") == 0)
                        _end_search = true;

                if (!_results_flag)
                        return;

                if (_li_sr_flag && strcasecmp(tag,"li") == 0)
                {
                        std::cout << "
" << std::endl;
                        _li_sr_flag = false;

                        // assert previous snippet if any.
                        if (pc->_current_snippet)
                        {
                                if (pc->_current_snippet->_title.empty()  // consider the parsing did fail on the snippet.
                                        || pc->_current_snippet->_url.empty()
                                        || pc->_current_snippet->_summary.empty()
                                        || pc->_current_snippet->_cite.empty())
                                {
                                        std::cout << "[snippet fail]" << " title: " << pc->_current_snippet->_title.empty() << " url: " << pc->_current_snippet->_url.empty() << " summary: " << pc->_current_snippet->_summary.empty() << " cite de mes deux: " << pc->_current_snippet->_cite.empty() << std::endl;
                                        delete pc->_current_snippet;
                                        pc->_current_snippet = NULL;
                                        _count--;
                                }
                                else pc->_snippets->push_back(pc->_current_snippet);
                        }

                }

                if (_a_sr_flag && strcasecmp(tag,"a") == 0)
                {
                        std::cout << "" << std::endl;
                        // TODO ici il faut rajouter le http:// jusqu'à /wiki/...
                        pc->_current_snippet->_title = _title;
                        _title = "";
                        pc->_current_snippet->set_url(_link);
                        std::cout << "URL " << pc->_current_snippet->_url.empty() << std::endl;
                        pc->_current_snippet->_cite = _link;
                        std::cout << "url=" << _link << std::endl;
                        _link = "";
                        _a_sr_flag = false;
                }

                if (_search_result && strcasecmp(tag, "div") == 0)
                {
                        std::cout << "
" << std::endl;

                        // some time, mediawiki don't give a body to it's result
                        if (_summary == "")
                                _summary = " ";

                        pc->_current_snippet->set_summary(_summary);
                        _summary = "";
                        _cite = "";
                        _search_result = false;
                }
        }

} /* end of namespace. */
<commit_msg>forget to add some stuff for the mediawiki parser<commit_after>/**
 * The Seeks proxy and plugin framework are part of the SEEKS project.
 * Copyright (C) 2009 Emmanuel Benazera, juban@free.fr
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "se_parser_mediawiki.h"
#include "miscutil.h"

#include <strings.h>
#include <iostream>

using sp::miscutil;

namespace seeks_plugins
{
        std::string se_parser_mediawiki::_mediawiki_stupid[2] =
        { "Document title", "Titre du document / Document title" };

        se_parser_mediawiki::se_parser_mediawiki()
                :se_parser(),_li_sr_flag(false),_a_sr_flag(false),_search_result(false),_end_search(true)
        {
        }

        se_parser_mediawiki::~se_parser_mediawiki()
        {
        }

        void se_parser_mediawiki::start_element(parser_context *pc,
                        const xmlChar *name,
                        const xmlChar **attributes)
        {
                const char *tag = (const char*)name;

                if (strcasecmp(tag, "ul") == 0)
                {
                        const char *a_class = se_parser::get_attribute((const char**)attributes, "class");
                        if (a_class && strcasecmp(a_class, "mw-search-results") == 0)
                        {
                                std::cout << "[START]" << std::endl;
                                _end_search = false;
                        }
                }
                if (!_end_search && strcasecmp(tag, "li") == 0)
                {
                        std::cout << "
" << std::endl;
                        _li_sr_flag = true;

                        // create new snippet.
                        search_snippet *sp = new search_snippet(_count + 1);
                        _count++;
                        sp->_engine |= std::bitset<NSEs>(SE_MEDIAWIKI);
                        pc->_current_snippet = sp;
                }
                if (!_end_search && strcasecmp(tag, "a") == 0 && _li_sr_flag)
                {
                        std::cout << "" << std::endl;
                        const char *a_link = se_parser::get_attribute((const char**)attributes,"href");
                        _link = std::string(a_link);
                        _a_sr_flag = true;

                        if (pc->_snippets->empty())
                                _results_flag = true;
                }
                if (!_end_search && _li_sr_flag && strcasecmp(tag, "div") == 0)
                {
                        const char *a_link = se_parser::get_attribute((const char**)attributes,"class");
                        if (strcasecmp(a_link, "searchresult") == 0)
                        {
                                std::cout << "
" << std::endl;
                                _search_result = true;
                        }
                }
        }

        void se_parser_mediawiki::characters(parser_context *pc,
                        const xmlChar *chars,
                        int length)
        {
                handle_characters(pc, chars, length);
        }

        void se_parser_mediawiki::cdata(parser_context *pc,
                        const xmlChar *chars,
                        int length)
        {
                handle_characters(pc, chars, length);
        }

        void se_parser_mediawiki::handle_characters(parser_context *pc,
                        const xmlChar *chars,
                        int length)
        {
                if (_a_sr_flag)
                {
                        std::string a_chars = std::string((char*)chars);
                        miscutil::replace_in_string(a_chars,"\n"," ");
                        miscutil::replace_in_string(a_chars,"\r"," ");
                        miscutil::replace_in_string(a_chars,"-"," ");
                        _title += a_chars;
                        std::cout << _title << std::endl;
                }
                if (_search_result)
                {
                        std::string a_chars = std::string((char*)chars);
                        miscutil::replace_in_string(a_chars,"\n"," ");
                        miscutil::replace_in_string(a_chars,"\r"," ");
                        miscutil::replace_in_string(a_chars,"-"," ");
                        _summary += a_chars;
                        std::cout << _summary << std::endl;
                }
        }

        void se_parser_mediawiki::end_element(parser_context *pc,
                        const xmlChar *name)
        {
                const char *tag = (const char*) name;

                if (!_end_search && strcasecmp(tag, "ul") == 0)
                        _end_search = true;

                if (!_results_flag)
                        return;

                if (_li_sr_flag && strcasecmp(tag,"li") == 0)
                {
                        std::cout << "
" << std::endl;
                        _li_sr_flag = false;

                        // assert previous snippet if any.
                        if (pc->_current_snippet)
                        {
                                if (pc->_current_snippet->_title.empty()  // consider the parsing did fail on the snippet.
                                        || pc->_current_snippet->_url.empty()
                                        || pc->_current_snippet->_summary.empty()
                                        || pc->_current_snippet->_cite.empty())
                                {
                                        std::cout << "[snippet fail]" << " title: " << pc->_current_snippet->_title.empty() << " url: " << pc->_current_snippet->_url.empty() << " summary: " << pc->_current_snippet->_summary.empty() << " cite de mes deux: " << pc->_current_snippet->_cite.empty() << std::endl;
                                        delete pc->_current_snippet;
                                        pc->_current_snippet = NULL;
                                        _count--;
                                }
                                else pc->_snippets->push_back(pc->_current_snippet);
                        }

                }

                if (_a_sr_flag && strcasecmp(tag,"a") == 0)
                {
                        std::cout << "" << std::endl;
                        // TODO ici il faut rajouter le http:// jusqu'à /wiki/...
                        pc->_current_snippet->_title = _title;
                        _title = "";
                        pc->_current_snippet->set_url(_link);
                        std::cout << "URL " << pc->_current_snippet->_url.empty() << std::endl;
                        pc->_current_snippet->_cite = _link;
                        std::cout << "url=" << _link << std::endl;
                        _link = "";
                        _a_sr_flag = false;
                }

                if (_search_result && strcasecmp(tag, "div") == 0)
                {
                        std::cout << "
" << std::endl;

                        // some time, mediawiki don't give a body to it's result
                        if (_summary == "")
                                _summary = " ";

                        pc->_current_snippet->set_summary(_summary);
                        _summary = "";
                        _cite = "";
                        _search_result = false;
                }
        }

} /* end of namespace. */
<|endoftext|>


<commit_before>/*
 * Copyright 2006-2008 The FLWOR Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "stdafx.h"

#include <iostream>

#ifdef ZORBA_WITH_DEBUGGER
#include "debugger/debugger_commons.h"
#endif
#include "functions/udf.h"
#include "runtime/booleans/BooleanImpl.h"
#include "runtime/collections/collections.h"
#include "runtime/core/apply_updates.h"
#include "runtime/core/arithmetic_impl.h"
#include "runtime/core/constructors.h"
#include "runtime/core/flwor_iterator.h"
#include "runtime/core/fncall_iterator.h"
#include "runtime/core/gflwor/count_iterator.h"
#include "runtime/core/gflwor/for_iterator.h"
#include "runtime/core/gflwor/groupby_iterator.h"
#include "runtime/core/gflwor/let_iterator.h"
#include "runtime/core/gflwor/outerfor_iterator.h"
#include "runtime/core/gflwor/tuplesource_iterator.h"
#include "runtime/core/gflwor/tuplestream_iterator.h"
#include "runtime/core/gflwor/where_iterator.h"
#include "runtime/core/gflwor/window_iterator.h"
#include "runtime/core/internal_operators.h"
#include "runtime/core/item_iterator.h"
#include "runtime/core/nodeid_iterators.h"
#include "runtime/core/path_iterators.h"
#include "runtime/core/sequencetypes.h"
#include "runtime/core/trycatch.h"
#include "runtime/core/var_iterators.h"
#ifdef ZORBA_WITH_DEBUGGER
#include "runtime/debug/debug_iterator.h"
#endif
#include "runtime/durations_dates_times/DurationsDatesTimesImpl.h"
#include "runtime/durations_dates_times/format_dateTime.h"
#include "runtime/eval/eval.h"
#ifndef ZORBA_NO_FULL_TEXT
#include "runtime/full_text/full_text.h"
#endif
#include "runtime/hof/dynamic_fncall_iterator.h"
#include "runtime/hof/function_item_iter.h"
#include "runtime/indexing/index_ddl.h"
#include "runtime/json/json_constructors.h"
#include "runtime/misc/materialize.h"
#include "runtime/numerics/NumericsImpl.h"
#include "runtime/scripting/scripting.h"
#include "runtime/sequences/SequencesImpl.h"
#include "runtime/update/update.h"
#include "runtime/visitors/profile_visitor.h"

using namespace std;

namespace zorba {

///////////////////////////////////////////////////////////////////////////////

void
get_pd( PlanIterator const &pi, PlanState &p_state ) {
  PlanIteratorState const *const pi_state =
    StateTraitsImpl<PlanIteratorState>::getState(
      p_state, pi.getStateOffset()
    );
  profile_data const &pd = pi_state->get_profile_data();
  cerr << "<iterator name=\"" << pi.getNameAsString() << "\" calls=\"" << pd.next_.call_count_ << "\" ms=\"" << pd.next_.cpu_time_ << "\"/>\n";
}

#define PROFILE_VISITOR_DEFINITION(...)                         \
  void ProfileVisitor::beginVisit( __VA_ARGS__ const &iter ) {  \
    get_pd( iter, plan_state_ );                                \
  }                                                             \
  void ProfileVisitor::endVisit( __VA_ARGS__ const& ) {         \
  }

PROFILE_VISITOR_DEFINITION( AncestorAxisIterator )
PROFILE_VISITOR_DEFINITION( AncestorReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( AncestorSelfAxisIterator )
PROFILE_VISITOR_DEFINITION( AncestorSelfReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( AndIterator )
PROFILE_VISITOR_DEFINITION( ApplyIterator )
PROFILE_VISITOR_DEFINITION( ArgumentPlaceholderIterator )
PROFILE_VISITOR_DEFINITION( AtomicValuesEquivalenceIterator )
PROFILE_VISITOR_DEFINITION( AttributeAxisIterator )
PROFILE_VISITOR_DEFINITION( AttributeIterator )
PROFILE_VISITOR_DEFINITION( CastableIterator )
PROFILE_VISITOR_DEFINITION( CastIterator )
PROFILE_VISITOR_DEFINITION( ChildAxisIterator )
PROFILE_VISITOR_DEFINITION( CommentIterator )
PROFILE_VISITOR_DEFINITION( CompareIterator )
PROFILE_VISITOR_DEFINITION( CreateIndexIterator )
PROFILE_VISITOR_DEFINITION( CreateInternalIndexIterator )
PROFILE_VISITOR_DEFINITION( CtxVarAssignIterator )
PROFILE_VISITOR_DEFINITION( CtxVarDeclareIterator )
PROFILE_VISITOR_DEFINITION( CtxVarIsSetIterator )
PROFILE_VISITOR_DEFINITION( CtxVarIterator )
#ifdef ZORBA_WITH_DEBUGGER
PROFILE_VISITOR_DEFINITION( DebuggerSingletonIterator )
#endif
PROFILE_VISITOR_DEFINITION( DeleteIndexIterator )
PROFILE_VISITOR_DEFINITION( DeleteIterator )
PROFILE_VISITOR_DEFINITION( DescendantAxisIterator )
PROFILE_VISITOR_DEFINITION( DescendantSelfAxisIterator )
PROFILE_VISITOR_DEFINITION( DocumentIterator )
PROFILE_VISITOR_DEFINITION( EitherNodesOrAtomicsIterator )
PROFILE_VISITOR_DEFINITION( ElementIterator )
PROFILE_VISITOR_DEFINITION( EmptyIterator )
PROFILE_VISITOR_DEFINITION( EnclosedIterator )
PROFILE_VISITOR_DEFINITION( EvalIterator )
PROFILE_VISITOR_DEFINITION( ExitCatcherIterator )
PROFILE_VISITOR_DEFINITION( ExitIterator )
PROFILE_VISITOR_DEFINITION( ExtFunctionCallIterator )
PROFILE_VISITOR_DEFINITION( FlowCtlIterator )
PROFILE_VISITOR_DEFINITION( flwor::CountIterator )
PROFILE_VISITOR_DEFINITION( flwor::FLWORIterator )
PROFILE_VISITOR_DEFINITION( flwor::ForIterator )
PROFILE_VISITOR_DEFINITION( flwor::GroupByIterator )
PROFILE_VISITOR_DEFINITION( flwor::LetIterator )
PROFILE_VISITOR_DEFINITION( flwor::OrderByIterator )
PROFILE_VISITOR_DEFINITION( flwor::OuterForIterator )
PROFILE_VISITOR_DEFINITION( flwor::TupleSourceIterator )
PROFILE_VISITOR_DEFINITION( flwor::TupleStreamIterator )
PROFILE_VISITOR_DEFINITION( flwor::WhereIterator )
PROFILE_VISITOR_DEFINITION( flwor::WindowIterator )
PROFILE_VISITOR_DEFINITION( FnAdjustToTimeZoneIterator_1 )
PROFILE_VISITOR_DEFINITION( FnAdjustToTimeZoneIterator_2 )
PROFILE_VISITOR_DEFINITION( FnBooleanIterator )
PROFILE_VISITOR_DEFINITION( FnDateTimeConstructorIterator )
PROFILE_VISITOR_DEFINITION( FnFormatDateTimeIterator )
PROFILE_VISITOR_DEFINITION( FnMinMaxIterator )
PROFILE_VISITOR_DEFINITION( FollowingAxisIterator )
PROFILE_VISITOR_DEFINITION( ForVarIterator )
#ifndef ZORBA_NO_FULL_TEXT
PROFILE_VISITOR_DEFINITION( FTContainsIterator )
#endif
PROFILE_VISITOR_DEFINITION( FunctionItemIterator )
PROFILE_VISITOR_DEFINITION( GeneralIndexEntryBuilderIterator )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<AddOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<DivideOperation>)
PROFILE_VISITOR_DEFINITION( GenericArithIterator<IntegerDivideOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<ModOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<MultiplyOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<SubtractOperation> )
PROFILE_VISITOR_DEFINITION( HoistIterator )
PROFILE_VISITOR_DEFINITION( IfThenElseIterator )
PROFILE_VISITOR_DEFINITION( InsertIterator )
PROFILE_VISITOR_DEFINITION( InstanceOfIterator )
PROFILE_VISITOR_DEFINITION( JSONArrayIterator )
PROFILE_VISITOR_DEFINITION( JSONDirectObjectIterator )
PROFILE_VISITOR_DEFINITION( JSONObjectIterator )
PROFILE_VISITOR_DEFINITION( LetVarIterator )
PROFILE_VISITOR_DEFINITION( LoopIterator )
PROFILE_VISITOR_DEFINITION( LSiblingAxisIterator )
PROFILE_VISITOR_DEFINITION( LSiblingReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( MaterializeIterator )
PROFILE_VISITOR_DEFINITION( MultiDynamicFnCallIterator )
PROFILE_VISITOR_DEFINITION( NameCastIterator )
PROFILE_VISITOR_DEFINITION( NamespaceIterator )
PROFILE_VISITOR_DEFINITION( NodeDistinctIterator )
PROFILE_VISITOR_DEFINITION( NodeSortIterator )
PROFILE_VISITOR_DEFINITION( NumArithIterator<AddOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<DivideOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<IntegerDivideOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<ModOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<MultiplyOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<SubtractOperation> )
PROFILE_VISITOR_DEFINITION( OpDoubleUnaryIterator )
PROFILE_VISITOR_DEFINITION( OpNumericUnaryIterator )
PROFILE_VISITOR_DEFINITION( OrIterator )
PROFILE_VISITOR_DEFINITION( ParentAxisIterator )
PROFILE_VISITOR_DEFINITION( PiIterator )
PROFILE_VISITOR_DEFINITION( PrecedingAxisIterator )
PROFILE_VISITOR_DEFINITION( PrecedingReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexPointGeneralIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexPointValueIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexRangeGeneralIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexRangeValueIterator )
PROFILE_VISITOR_DEFINITION( PromoteIterator )
PROFILE_VISITOR_DEFINITION( RefreshIndexIterator )
PROFILE_VISITOR_DEFINITION( RenameIterator )
PROFILE_VISITOR_DEFINITION( ReplaceIterator )
PROFILE_VISITOR_DEFINITION( RSiblingAxisIterator )
PROFILE_VISITOR_DEFINITION( SelfAxisIterator )
PROFILE_VISITOR_DEFINITION( SequentialIterator )
PROFILE_VISITOR_DEFINITION( SingleDynamicFnCallIterator )
PROFILE_VISITOR_DEFINITION( SingletonIterator )
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( TextIterator )
PROFILE_VISITOR_DEFINITION( TransformIterator )
PROFILE_VISITOR_DEFINITION( TreatIterator )
PROFILE_VISITOR_DEFINITION( TryCatchIterator )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_DECIMAL> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_DOUBLE> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_FLOAT> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_INTEGER> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_STRING> )
PROFILE_VISITOR_DEFINITION( UDFunctionCallIterator )
PROFILE_VISITOR_DEFINITION( UnhoistIterator )
PROFILE_VISITOR_DEFINITION( ValueIndexEntryBuilderIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertAfterIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertBeforeIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertFirstIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertLastIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertAfterIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertBeforeIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertFirstIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertLastIterator )

///////////////////////////////////////////////////////////////////////////////

void ProfileVisitor::beginVisitFlworWhereClause(const PlanIterator& a) {
}

void ProfileVisitor::endVisitFlworWhereClause(const PlanIterator& ) {
}

void ProfileVisitor::beginVisitFlworLetVariable(
    bool materialize,
    const zstring& varName,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitFlworLetVariable() {
}

void ProfileVisitor::beginVisitFlworForVariable(
    const zstring& varName,
    const std::vector<PlanIter_t>& varRefs,
    const std::vector<PlanIter_t>& posRefs)
{
}

void ProfileVisitor::endVisitFlworForVariable() {
}

void ProfileVisitor::beginVisitOrderBySpec(const PlanIterator& a) {
}

void ProfileVisitor::endVisitOrderBySpec(const PlanIterator& ) {
}

void ProfileVisitor::beginVisitOrderByForVariable(
    ForVarIter_t inputVar,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitOrderByForVariable() {
}

void ProfileVisitor::beginVisitOrderByLetVariable(
    LetVarIter_t inputVar,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitOrderByLetVariable() {
}

void ProfileVisitor::beginVisitMaterializeClause() {
}

void ProfileVisitor::endVisitMaterializeClause() {
}

void ProfileVisitor::beginVisitMaterializeVariable(
    bool forVar,
    PlanIter_t inputVar,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitMaterializeVariable() {
}

void ProfileVisitor::beginVisitGroupByClause() {
}

void ProfileVisitor::endVisitGroupByClause() {
}

void ProfileVisitor::beginVisitGroupBySpec() {
}

void ProfileVisitor::endVisitGroupBySpec() {
}

void ProfileVisitor::beginVisitGroupByOuter() {
}

void ProfileVisitor::endVisitGroupByOuter() {
}

void ProfileVisitor::beginVisitGroupVariable(const std::vector<ForVarIter_t>& varRefs) {
}

void ProfileVisitor::endVisitGroupVariable() {
}

void ProfileVisitor::beginVisitNonGroupVariable(const std::vector<LetVarIter_t>& varRefs) {
}

void ProfileVisitor::endVisitNonGroupVariable() {
}

void ProfileVisitor::beginVisitWindowVariable(
    const std::string& varName,
    const std::vector<LetVarIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitWindowVariable() {
}

void ProfileVisitor::beginVisitWinCondVariable(
    const zstring& varName,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitWinCondVariable() {
}

void ProfileVisitor::beginVisitFlworReturn( const PlanIterator& a) {
}

void ProfileVisitor::endVisitFlworReturn( const PlanIterator& ) {
}

///////////////////////////////////////////////////////////////////////////////

} // namespace zorba
/* vim:set et sw=2 ts=2: */
<commit_msg>Intermediate check-in.<commit_after>/*
 * Copyright 2006-2008 The FLWOR Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "stdafx.h"

#include <iostream>

#ifdef ZORBA_WITH_DEBUGGER
#include "debugger/debugger_commons.h"
#endif
#include "functions/udf.h"
#include "runtime/booleans/BooleanImpl.h"
#include "runtime/collections/collections.h"
#include "runtime/core/apply_updates.h"
#include "runtime/core/arithmetic_impl.h"
#include "runtime/core/constructors.h"
#include "runtime/core/flwor_iterator.h"
#include "runtime/core/fncall_iterator.h"
#include "runtime/core/gflwor/count_iterator.h"
#include "runtime/core/gflwor/for_iterator.h"
#include "runtime/core/gflwor/groupby_iterator.h"
#include "runtime/core/gflwor/let_iterator.h"
#include "runtime/core/gflwor/outerfor_iterator.h"
#include "runtime/core/gflwor/tuplesource_iterator.h"
#include "runtime/core/gflwor/tuplestream_iterator.h"
#include "runtime/core/gflwor/where_iterator.h"
#include "runtime/core/gflwor/window_iterator.h"
#include "runtime/core/internal_operators.h"
#include "runtime/core/item_iterator.h"
#include "runtime/core/nodeid_iterators.h"
#include "runtime/core/path_iterators.h"
#include "runtime/core/sequencetypes.h"
#include "runtime/core/trycatch.h"
#include "runtime/core/var_iterators.h"
#ifdef ZORBA_WITH_DEBUGGER
#include "runtime/debug/debug_iterator.h"
#endif
#include "runtime/durations_dates_times/DurationsDatesTimesImpl.h"
#include "runtime/durations_dates_times/format_dateTime.h"
#include "runtime/eval/eval.h"
#ifndef ZORBA_NO_FULL_TEXT
#include "runtime/full_text/full_text.h"
#endif
#include "runtime/hof/dynamic_fncall_iterator.h"
#include "runtime/hof/function_item_iter.h"
#include "runtime/indexing/index_ddl.h"
#include "runtime/json/json_constructors.h"
#include "runtime/misc/materialize.h"
#include "runtime/numerics/NumericsImpl.h"
#include "runtime/scripting/scripting.h"
#include "runtime/sequences/SequencesImpl.h"
#include "runtime/update/update.h"
#include "runtime/visitors/profile_visitor.h"

using namespace std;

namespace zorba {

///////////////////////////////////////////////////////////////////////////////

#if 0
void
get_pd( PlanIterator const &pi, PlanState &p_state ) {
  PlanIteratorState const *const pi_state =
    StateTraitsImpl<PlanIteratorState>::getState(
      p_state, pi.getStateOffset()
    );
  profile_data const &pd = pi_state->get_profile_data();
  cerr << "<iterator name=\"" << pi.getNameAsString() << "\" calls=\"" << pd.next_.call_count_ << "\" ms=\"" << pd.next_.cpu_time_ << "\"/>\n";
}
#endif

#define PROFILE_VISITOR_DEFINITION(...)                         \
  void ProfileVisitor::beginVisit( __VA_ARGS__ const &iter ) {  \
  }                                                             \
  void ProfileVisitor::endVisit( __VA_ARGS__ const& ) {         \
  }

PROFILE_VISITOR_DEFINITION( AncestorAxisIterator )
PROFILE_VISITOR_DEFINITION( AncestorReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( AncestorSelfAxisIterator )
PROFILE_VISITOR_DEFINITION( AncestorSelfReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( AndIterator )
PROFILE_VISITOR_DEFINITION( ApplyIterator )
PROFILE_VISITOR_DEFINITION( ArgumentPlaceholderIterator )
PROFILE_VISITOR_DEFINITION( AtomicValuesEquivalenceIterator )
PROFILE_VISITOR_DEFINITION( AttributeAxisIterator )
PROFILE_VISITOR_DEFINITION( AttributeIterator )
PROFILE_VISITOR_DEFINITION( CastableIterator )
PROFILE_VISITOR_DEFINITION( CastIterator )
PROFILE_VISITOR_DEFINITION( ChildAxisIterator )
PROFILE_VISITOR_DEFINITION( CommentIterator )
PROFILE_VISITOR_DEFINITION( CompareIterator )
PROFILE_VISITOR_DEFINITION( CreateIndexIterator )
PROFILE_VISITOR_DEFINITION( CreateInternalIndexIterator )
PROFILE_VISITOR_DEFINITION( CtxVarAssignIterator )
PROFILE_VISITOR_DEFINITION( CtxVarDeclareIterator )
PROFILE_VISITOR_DEFINITION( CtxVarIsSetIterator )
PROFILE_VISITOR_DEFINITION( CtxVarIterator )
#ifdef ZORBA_WITH_DEBUGGER
PROFILE_VISITOR_DEFINITION( DebuggerSingletonIterator )
#endif
PROFILE_VISITOR_DEFINITION( DeleteIndexIterator )
PROFILE_VISITOR_DEFINITION( DeleteIterator )
PROFILE_VISITOR_DEFINITION( DescendantAxisIterator )
PROFILE_VISITOR_DEFINITION( DescendantSelfAxisIterator )
PROFILE_VISITOR_DEFINITION( DocumentIterator )
PROFILE_VISITOR_DEFINITION( EitherNodesOrAtomicsIterator )
PROFILE_VISITOR_DEFINITION( ElementIterator )
PROFILE_VISITOR_DEFINITION( EmptyIterator )
PROFILE_VISITOR_DEFINITION( EnclosedIterator )
PROFILE_VISITOR_DEFINITION( EvalIterator )
PROFILE_VISITOR_DEFINITION( ExitCatcherIterator )
PROFILE_VISITOR_DEFINITION( ExitIterator )
PROFILE_VISITOR_DEFINITION( ExtFunctionCallIterator )
PROFILE_VISITOR_DEFINITION( FlowCtlIterator )
PROFILE_VISITOR_DEFINITION( flwor::CountIterator )
PROFILE_VISITOR_DEFINITION( flwor::FLWORIterator )
PROFILE_VISITOR_DEFINITION( flwor::ForIterator )
PROFILE_VISITOR_DEFINITION( flwor::GroupByIterator )
PROFILE_VISITOR_DEFINITION( flwor::LetIterator )
PROFILE_VISITOR_DEFINITION( flwor::OrderByIterator )
PROFILE_VISITOR_DEFINITION( flwor::OuterForIterator )
PROFILE_VISITOR_DEFINITION( flwor::TupleSourceIterator )
PROFILE_VISITOR_DEFINITION( flwor::TupleStreamIterator )
PROFILE_VISITOR_DEFINITION( flwor::WhereIterator )
PROFILE_VISITOR_DEFINITION( flwor::WindowIterator )
PROFILE_VISITOR_DEFINITION( FnAdjustToTimeZoneIterator_1 )
PROFILE_VISITOR_DEFINITION( FnAdjustToTimeZoneIterator_2 )
PROFILE_VISITOR_DEFINITION( FnBooleanIterator )
PROFILE_VISITOR_DEFINITION( FnDateTimeConstructorIterator )
PROFILE_VISITOR_DEFINITION( FnFormatDateTimeIterator )
PROFILE_VISITOR_DEFINITION( FnMinMaxIterator )
PROFILE_VISITOR_DEFINITION( FollowingAxisIterator )
PROFILE_VISITOR_DEFINITION( ForVarIterator )
#ifndef ZORBA_NO_FULL_TEXT
PROFILE_VISITOR_DEFINITION( FTContainsIterator )
#endif
PROFILE_VISITOR_DEFINITION( FunctionItemIterator )
PROFILE_VISITOR_DEFINITION( GeneralIndexEntryBuilderIterator )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<AddOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<DivideOperation>)
PROFILE_VISITOR_DEFINITION( GenericArithIterator<IntegerDivideOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<ModOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<MultiplyOperation> )
PROFILE_VISITOR_DEFINITION( GenericArithIterator<SubtractOperation> )
PROFILE_VISITOR_DEFINITION( HoistIterator )
PROFILE_VISITOR_DEFINITION( IfThenElseIterator )
PROFILE_VISITOR_DEFINITION( InsertIterator )
PROFILE_VISITOR_DEFINITION( InstanceOfIterator )
PROFILE_VISITOR_DEFINITION( JSONArrayIterator )
PROFILE_VISITOR_DEFINITION( JSONDirectObjectIterator )
PROFILE_VISITOR_DEFINITION( JSONObjectIterator )
PROFILE_VISITOR_DEFINITION( LetVarIterator )
PROFILE_VISITOR_DEFINITION( LoopIterator )
PROFILE_VISITOR_DEFINITION( LSiblingAxisIterator )
PROFILE_VISITOR_DEFINITION( LSiblingReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( MaterializeIterator )
PROFILE_VISITOR_DEFINITION( MultiDynamicFnCallIterator )
PROFILE_VISITOR_DEFINITION( NameCastIterator )
PROFILE_VISITOR_DEFINITION( NamespaceIterator )
PROFILE_VISITOR_DEFINITION( NodeDistinctIterator )
PROFILE_VISITOR_DEFINITION( NodeSortIterator )
PROFILE_VISITOR_DEFINITION( NumArithIterator<AddOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<DivideOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<IntegerDivideOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<ModOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<MultiplyOperation> )
PROFILE_VISITOR_DEFINITION( NumArithIterator<SubtractOperation> )
PROFILE_VISITOR_DEFINITION( OpDoubleUnaryIterator )
PROFILE_VISITOR_DEFINITION( OpNumericUnaryIterator )
PROFILE_VISITOR_DEFINITION( OrIterator )
PROFILE_VISITOR_DEFINITION( ParentAxisIterator )
PROFILE_VISITOR_DEFINITION( PiIterator )
PROFILE_VISITOR_DEFINITION( PrecedingAxisIterator )
PROFILE_VISITOR_DEFINITION( PrecedingReverseAxisIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexPointGeneralIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexPointValueIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexRangeGeneralIterator )
PROFILE_VISITOR_DEFINITION( ProbeIndexRangeValueIterator )
PROFILE_VISITOR_DEFINITION( PromoteIterator )
PROFILE_VISITOR_DEFINITION( RefreshIndexIterator )
PROFILE_VISITOR_DEFINITION( RenameIterator )
PROFILE_VISITOR_DEFINITION( ReplaceIterator )
PROFILE_VISITOR_DEFINITION( RSiblingAxisIterator )
PROFILE_VISITOR_DEFINITION( SelfAxisIterator )
PROFILE_VISITOR_DEFINITION( SequentialIterator )
PROFILE_VISITOR_DEFINITION( SingleDynamicFnCallIterator )
PROFILE_VISITOR_DEFINITION( SingletonIterator )
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<AddOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<DivideOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<ModOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<MultiplyOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_DECIMAL>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_DOUBLE>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_FLOAT>)
PROFILE_VISITOR_DEFINITION( SpecificNumArithIterator<SubtractOperation,store::XS_INTEGER>)
PROFILE_VISITOR_DEFINITION( TextIterator )
PROFILE_VISITOR_DEFINITION( TransformIterator )
PROFILE_VISITOR_DEFINITION( TreatIterator )
PROFILE_VISITOR_DEFINITION( TryCatchIterator )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_DECIMAL> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_DOUBLE> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_FLOAT> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_INTEGER> )
PROFILE_VISITOR_DEFINITION( TypedValueCompareIterator<store::XS_STRING> )
PROFILE_VISITOR_DEFINITION( UDFunctionCallIterator )
PROFILE_VISITOR_DEFINITION( UnhoistIterator )
PROFILE_VISITOR_DEFINITION( ValueIndexEntryBuilderIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertAfterIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertBeforeIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertFirstIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertIterator )
PROFILE_VISITOR_DEFINITION( ZorbaApplyInsertLastIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertAfterIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertBeforeIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertFirstIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertIterator )
PROFILE_VISITOR_DEFINITION( ZorbaInsertLastIterator )

///////////////////////////////////////////////////////////////////////////////

void ProfileVisitor::beginVisitFlworWhereClause(const PlanIterator& a) {
}

void ProfileVisitor::endVisitFlworWhereClause(const PlanIterator& ) {
}

void ProfileVisitor::beginVisitFlworLetVariable(
    bool materialize,
    const zstring& varName,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitFlworLetVariable() {
}

void ProfileVisitor::beginVisitFlworForVariable(
    const zstring& varName,
    const std::vector<PlanIter_t>& varRefs,
    const std::vector<PlanIter_t>& posRefs)
{
}

void ProfileVisitor::endVisitFlworForVariable() {
}

void ProfileVisitor::beginVisitOrderBySpec(const PlanIterator& a) {
}

void ProfileVisitor::endVisitOrderBySpec(const PlanIterator& ) {
}

void ProfileVisitor::beginVisitOrderByForVariable(
    ForVarIter_t inputVar,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitOrderByForVariable() {
}

void ProfileVisitor::beginVisitOrderByLetVariable(
    LetVarIter_t inputVar,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitOrderByLetVariable() {
}

void ProfileVisitor::beginVisitMaterializeClause() {
}

void ProfileVisitor::endVisitMaterializeClause() {
}

void ProfileVisitor::beginVisitMaterializeVariable(
    bool forVar,
    PlanIter_t inputVar,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitMaterializeVariable() {
}

void ProfileVisitor::beginVisitGroupByClause() {
}

void ProfileVisitor::endVisitGroupByClause() {
}

void ProfileVisitor::beginVisitGroupBySpec() {
}

void ProfileVisitor::endVisitGroupBySpec() {
}

void ProfileVisitor::beginVisitGroupByOuter() {
}

void ProfileVisitor::endVisitGroupByOuter() {
}

void ProfileVisitor::beginVisitGroupVariable(const std::vector<ForVarIter_t>& varRefs) {
}

void ProfileVisitor::endVisitGroupVariable() {
}

void ProfileVisitor::beginVisitNonGroupVariable(const std::vector<LetVarIter_t>& varRefs) {
}

void ProfileVisitor::endVisitNonGroupVariable() {
}

void ProfileVisitor::beginVisitWindowVariable(
    const std::string& varName,
    const std::vector<LetVarIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitWindowVariable() {
}

void ProfileVisitor::beginVisitWinCondVariable(
    const zstring& varName,
    const std::vector<PlanIter_t>& varRefs)
{
}

void ProfileVisitor::endVisitWinCondVariable() {
}

void ProfileVisitor::beginVisitFlworReturn( const PlanIterator& a) {
}

void ProfileVisitor::endVisitFlworReturn( const PlanIterator& ) {
}

///////////////////////////////////////////////////////////////////////////////

} // namespace zorba
/* vim:set et sw=2 ts=2: */
<|endoftext|>