示例#1
0
/*
 * parse sdp. compared to real-rtsp, it doesn't do much here
 * because asf_header will have all stream information.
 * thus it only does simplest stuff, extract asf header.
 */
struct sdpwms_t *wmserver_parse_sdp(char *data)
{
    char *p;                      /* always points first char of line in 'data' */
    char *buf = NULL;
    int buf_len = 0;              /* don't touch it after here !!*/
    char *decoded = NULL;
    int decoded_len = 0;          /* don't touch it after here   */
    struct sdpwms_t *desc = NULL;
    struct sdpwms_stream_t *stream = NULL;
  
    desc = new_sdpwms_t();

    for(p = data ; p && *p ; ) {
    
	if(is_line(p,"a=pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,",&buf,&buf_len)) {
	    keep_dec_size(&decoded,&decoded_len,strlen(buf));
	    desc->asf_header_len = base64_decode(buf,decoded,decoded_len);
	    desc->asf_header = (uint8_t *)xmalloc(desc->asf_header_len);
	    memcpy(desc->asf_header,decoded,desc->asf_header_len);
	    p = next_line(p);
	}
	else if(is_line(p,"m=",&buf,&buf_len)) { /* stream description */
	    stream = sdpwms_parse_stream(&p);    /* p is at the end of stream desc */
	    list_h_append(&desc->streams,stream);
	}
	else {
	    p = next_line(p);
	}
    }
  
    free(buf);
    free(decoded);
  
    return desc;
}
示例#2
0
void Config::loadToMemory(std::string file)
{
	mFile.open(file);
	SAssert(mFile.is_open(), "Could not open config file: " + mFilePath);
	std::string line = "";
	while(std::getline(mFile, line))
	{


		std::size_t comment = line.find('#', 0);
		if(comment == std::string::npos)
		{
			
				//Removes Spaces
				std::string::size_type space = line.find(' ');
				while (std::string::npos != space)
				{
					line.erase(space, 1);
					space = line.find(' ');
				}

				std::istringstream is_line(line);
				std::string key;
				if( std::getline(is_line, key, '=') )
				{
					std::string value;
					if( std::getline(is_line, value) ) 
					{
						mConfData.emplace(key, value);
					}
				
			}
		}
	}
}
示例#3
0
/*
	This function relevant only for line modules/chips
	Returns string with external port index
*/
char *portmapstring(Port *port)
{
	static char mapping[OUT_BUFFER_SIZE];
	ChassisRecord *ch = port->node->chrecord;
	int portnum = port->portnum;
	int chipnum = 0;
	int pindex = 0;
	Node *node = port->node;

	if (!ch || !is_line(node) || (portnum < 13 || portnum > 24))
		return NULL;

	if (ch->anafanum < 1 || ch->anafanum > 2)
		return NULL;

	memset(mapping, 0, sizeof(mapping));

	chipnum = ch->anafanum - 1;

	if (is_line_24(node))
		pindex = int2ext_map_slb24[chipnum][portnum];
	else if (is_line_2024(node))
		pindex = int2ext_map_slb2024[chipnum][portnum];
	else
		pindex = int2ext_map_slb8[chipnum][portnum];

	sprintf(mapping, "[ext %d]", pindex);

	return mapping;
}
示例#4
0
static void pass_on_lines_catch_spines(ChassisList *chassislist)
{
	Node *node, *remnode;
	Port *port;
	int i;

	for (i = 1; i <= LINES_MAX_NUM; i++) {
		node = chassislist->linenode[i];

		if (!(node && is_line(node)))
			continue;	/* empty slot or router */

		for (port = node->ports; port; port = port->next) {
			if (port->portnum > 12)
				continue;

			if (!port->remoteport)
				continue;
			remnode = port->remoteport->node;

			if (!remnode->chrecord)
				continue;	/* some error - spine not initialized ? FIXME */
			insert_spine(remnode, chassislist);
		}
	}
}
示例#5
0
struct sdpwms_stream_t *sdpwms_parse_stream(char **data)
{
    struct sdpwms_stream_t *stream;
    char *p = *data;
    char *buf = NULL;
    int buf_len = 0; /* don't touch it!! after here */
    char *decoded = NULL;
    int decoded_len = 0; /* don't touch it after here*/
    decoded_len = 0; /* shut up compiler !! */

  
    stream = new_sdpwms_stream_t();
  
    if(is_line(p,"m=",&buf,&buf_len)) {
	stream->id = strdup(buf);
	display(MSDL_VER,"stream: %s\n",stream->id);
	p = next_line(p);
    }
    else {
	display(MSDL_ERR,"no 'm=' line\n");
	free_sdpwms_stream_t(stream);
	return NULL;
    }
  
    for( ; p && *p && (p[0] != 'm'); ) {
    
	if(is_line(p,"a=control:",&buf,&buf_len)) {
	    stream->control = strdup(buf);
	    p = next_line(p);
	}
	else if(is_line(p,"a=stream:",&buf,&buf_len)) {
	    stream->streamnum = atoi(buf);
	    p = next_line(p);
	}
	else {
	    p = next_line(p);
	}
    }
  
    free(buf);
    free(decoded);
  
    *data = p;

    return stream;
}
示例#6
0
EngineRoutines::SettingsFile::SettingsFile(const std::string& filename, bool save_on_close)
    : fname(filename)
    , saveOnClose(save_on_close)
{

    std::ifstream f(filename);
    if (f.good() == false) {
        // create file
        // TODO: add extra checks if the path is good
        f.open(filename, std::ios_base::out);
    }
    else
    {
        // solution from http://stackoverflow.com/questions/6892754/creating-a-simple-configuration-file-and-parser-in-c
        std::string line;
        while (std::getline(f, line))
        {
            std::istringstream is_line(line);
            std::string key;
            if (std::getline(is_line, key, '='))
            {
                std::string value;
                if (std::getline(is_line, value))
                    settings[key] = value;
            }
        }
    }
    f.close();

    /*
    const char config[] = "url=http://mysite.com\n"
        "file=main.exe\n"
        "true=0";

    std::istringstream is_file(config);

    std::string line;
    while (std::getline(is_file, line))
    {
        std::istringstream is_line(line);
        std::string key;
        if (std::getline(is_line, key, '='))
        {
            std::string value;
            if (std::getline(is_line, value))
                store_line(key, value);
        }
    }
    */
}
示例#7
0
/*
	This function called for every Voltaire node in fabric
	It could be optimized so, but time overhead is very small
	and its only diag.util
*/
static void fill_chassis_record(Node *node)
{
	Port *port;
	Node *remnode = 0;
	ChassisRecord *ch = 0;

	if (node->chrecord) /* somehow this node has already been passed */
		return;

	if (!(node->chrecord = calloc(1, sizeof(ChassisRecord))))
		IBPANIC("out of mem");

	ch = node->chrecord;

	/* node is router only in case of using unique lid */
	/* (which is lid of chassis router port) */
	/* in such case node->ports is actually a requested port... */
	if (is_router(node) && is_spine(node->ports->remoteport->node))
		get_router_slot(node, node->ports->remoteport);
	else if (is_spine(node)) {
		for (port = node->ports; port; port = port->next) {
			if (!port->remoteport)
				continue;
			remnode = port->remoteport->node;
			if (remnode->type != SWITCH_NODE) {
				if (!remnode->chrecord)
					get_router_slot(remnode, port);
				continue;
			}
			if (!ch->chassistype)
				/* we assume here that remoteport belongs to line */
				get_sfb_slot(node, port->remoteport);

				/* we could break here, but need to find if more routers connected */
		}

	} else if (is_line(node)) {
		for (port = node->ports; port; port = port->next) {
			if (port->portnum > 12)
				continue;
			if (!port->remoteport)
				continue;
			/* we assume here that remoteport belongs to spine */
			get_slb_slot(ch, port->remoteport);
			break;
		}
	}

	return;
}
示例#8
0
void Config::saveConfigChange()
{
	close();
	mFile.open(mFilePath);
	SAssert(mFile.is_open(), "Could not open config file: " + mFilePath);

	std::string tempString = "";
	std::string line = "";
	while(std::getline(mFile, line))
	{
		std::size_t comment = line.find('#', 0);
		if(comment == std::string::npos)
		{
			//Removes Spaces
			std::string::size_type space = line.find(' ');
			while (std::string::npos != space)
			{
				line.erase(space, 1);
				space = line.find(' ');
			}
			std::istringstream is_line(line);
			std::string key;
			if( std::getline(is_line, key, '=') )
			{
				std::string value;
				if( std::getline(is_line, value) ) 
				{
					std::map<std::string, std::string>::iterator it = mConfData.find(key);

					value = it->second;

					line = key + " = " + value;
				}
			}
		}
		for( std::size_t i = 0; i < line.length(); i++ )
		{
			tempString.push_back(line.at(i));
		}

		tempString.push_back('\n');
	}
	std::filebuf fb;
	fb.open(mFilePath, std::ios::out);
	std::ostream os(&fb);
	os << tempString;
	fb.close();

}
示例#9
0
void ConfParser::parse_file(std::string filename)
{
	std::ifstream infile (filename.c_str());
	
	bool in_domains = false;
	
	std::string line;
	std::string key;
	std::string value;
	
	while( std::getline(infile, line) ) {
		if (line.size() != 0) {
			//Remove comments if necessary
			int eol = line.find("#");
			if (eol != -1) {
				line = line.substr(eol,line.size()-eol);
			}
		
			std::istringstream is_line(line);
			
			//Handle the DOMAINS array
			if (in_domains) {
				this->m_domains.push_back(this->handle_array_line(line));
				if (line.find("]") != std::string::npos) {
					in_domains = false;
				}
			}
			//Else look for the key=value structure
			else if( std::getline(is_line, key, '=') ) {
				if( std::getline(is_line, value) ) {
					if (key.compare("DOMAINS")==0) {
						in_domains = true;
						this->m_domains.push_back(this->handle_array_line(value));
					}
					else {
						store_line(key, value);
					}
				}
			}
			else {
				std::cerr << "Non-valid line in conf file: "<<line<<std::endl;
				exit(EXIT_FAILURE);
			}
		}
	}
}
示例#10
0
//takes sorted points
std::vector<Point2D> graham_scan(std::vector<Point2D> points)
{
    std::vector<Point2D> st;
    if(is_line(points))
    {
        st.push_back(points[0]);
        st.push_back(points[points.size() - 1]);
        return st;
    }
    Point2D rightest = points[0];
    int rightest_pos = 0;
    for(int i = 0; i < points.size(); i++)
    {
        if(points[i].x > rightest.x || (points[i].x == rightest.x && points[i].y < rightest.y))
        {
            rightest = points[i];
            rightest_pos = i;
        }
    }

    int cur = 1;
    st.push_back(points[get_index(rightest_pos  - 1, points.size())]);
    st.push_back(points[rightest_pos]);
    while(!(st[1] == st[st.size() - 1]  &&   st.size() > 2))
    {
        long long int left = is_left(st[st.size() - 2], st[st.size() - 1], points[get_index(cur + rightest_pos, points.size())]);
        if( left > 0)
        {
            st.push_back(points[get_index(cur + rightest_pos, points.size())]);
            cur++;
        }
        else
        {
            st.pop_back();
            //cur--;
        }
    }

    st.erase(st.begin());
    st.pop_back();
    return st;


}
示例#11
0
int
ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name)
{
  FILE *fp = ACE_OS::fopen (fname, ACE_TEXT ("r"));

  if (fp == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("Can't open %s file\n"),
                       fname),
                      -1);

  int done;
  ACE_TString line;

  while (0 == (done = (this->getline (fp, line) == -1))
         && is_empty (line.c_str ()))
    continue;

  while (!done)
    {
      ACE_TString newline;
      ACE_TString description;

      while (0 == (done = (this->getline (fp, newline) == -1)))
        if (is_line (newline.c_str ()))
          description += newline;
        else
          break;

      if (this->is_entry (name, line.c_str()))
        {
          ACE_OS::fclose (fp);
          return this->fillent (description.c_str ());
        }

      line = newline;
      while (!done && is_empty (line.c_str ()))
        done = this->getline (fp, line) == -1;
    }

  ACE_OS::fclose (fp);
  return -1;
}
示例#12
0
std::vector<Point2D> graham_scan(std::vector<Point2D> points, Point2D pole)
{
    std::vector<Point2D> st;

    points.push_back(pole);
    if(is_line(points))
    {
        st.push_back(points[points.size() - 1]);
        st.push_back(points[points.size() - 2]);
        return st;
    }
    points.pop_back();


    st.push_back(points[points.size() - 1]);
    st.push_back(pole);

    for(int i = 0; i < points.size(); i++)
    {
        long long int left = is_left(st[st.size() - 2], st[st.size() - 1], points[i] );
        if( left > 0)
        {
            if(!(points[i] == st[0]) && !(points[i] == st[1]))
            st.push_back(points[i]);
        }
        else
        {
            st.pop_back();
            i--;
        }
    }
    //test of 3 last points on one line
    if(is_left(st[st.size() - 2], st[st.size() - 1], points[points.size() - 1]) == 0)
    {
        st.pop_back();
    }



    return st;

}
示例#13
0
文件: chassis.c 项目: Cai900205/test
/* map internal ports to external ports if appropriate */
static void voltaire_portmap(ibnd_port_t * port)
{
	int portnum = port->portnum;
	int chipnum = 0;
	ibnd_node_t *node = port->node;
	int is_4700_line = is_line_4700(node);
	int is_4700x2_spine = is_spine_4700x2(node);

	if (!node->ch_found || (!is_line(node) && !is_4700x2_spine)) {
		port->ext_portnum = 0;
		return;
	}

	if (((is_4700_line || is_4700x2_spine) &&
	     (portnum < 19 || portnum > 36)) ||
	    ((!is_4700_line && !is_4700x2_spine) &&
	     (portnum < 13 || portnum > 24))) {
			port->ext_portnum = 0;
		return;
	}

	if (port->node->ch_anafanum < 1 || port->node->ch_anafanum > 2) {
		port->ext_portnum = 0;
		return;
	}

	chipnum = port->node->ch_anafanum - 1;

	if (is_line_24(node))
		port->ext_portnum = int2ext_map_slb24[chipnum][portnum];
	else if (is_line_2024(node))
		port->ext_portnum = int2ext_map_slb2024[chipnum][portnum];
	/* sLB-4018: Only one asic per LB */
	else if (is_4700_line)
		port->ext_portnum = int2ext_map_slb4018[portnum];
	/* sFB-4700X2 4X port */
	else if (is_4700x2_spine)
		port->ext_portnum = int2ext_map_sfb4700x2[chipnum][portnum];
	else
		port->ext_portnum = int2ext_map_slb8[chipnum][portnum];
}
示例#14
0
int		add_to_list(t_list **list, int i, int j, char **tab)
{
  t_list	*elem;
  int		nbr;
  int		pos;

  if ((elem = malloc(sizeof(t_list))) == NULL)
    return (-1);
  elem->i = i;
  elem->j = j;
  nbr = 0;
  pos = 0;
  while (++nbr < 10)
    if (is_line(tab, i, (nbr + '0')) == 0 &&
	is_column(tab, j, (nbr + '0')) == 0 &&
	is_block(tab, i, j, (nbr + '0')) == 0)
      ++pos;
  elem->possibilities = pos;
  elem->next = *list;
  *list = elem;
  return (0);
}
示例#15
0
void parseConfigFile(const std::string& configFilename, avtranscoder::Transcoder& transcoder)
{
    std::ifstream configFile(configFilename.c_str(), std::ifstream::in);

    std::string line;
    while(std::getline(configFile, line))
    {
        std::istringstream is_line(line);
        std::string filename;
        if(std::getline(is_line, filename, '='))
        {
            std::string streamId;
            if(std::getline(is_line, streamId, ':'))
            {
                std::string transcodeProfile;
                std::getline(is_line, transcodeProfile);

                std::stringstream ss(streamId);
                size_t streamIndex = 0;
                char separator = 'x';
                std::vector<size_t> channelIndexArray;
                ss >> streamIndex;
                ss >> separator;
                if(separator == '.')
                {
                    int subStreamIndex = -1;
                    ss >> subStreamIndex;
                    channelIndexArray.push_back(subStreamIndex);
                }

                // generated stream
                if(!filename.length())
                    transcoder.addGenerateStream(transcodeProfile);
                else
                {
                    avtranscoder::InputStreamDesc inputDesc(filename, streamIndex, channelIndexArray);
                    transcoder.addStream(inputDesc, transcodeProfile);
                }
            }
示例#16
0
文件: chassis.c 项目: Cai900205/test
static int pass_on_lines_catch_spines(ibnd_chassis_t * chassis)
{
	ibnd_node_t *node, *remnode;
	ibnd_port_t *port;
	int i, p;

	for (i = 1; i <= LINES_MAX_NUM; i++) {
		int is_4700_line;

		node = chassis->linenode[i];

		if (!(node && is_line(node)))
			continue;	/* empty slot or router */

		is_4700_line = is_line_4700(node);

		for (p = 1; p <= node->numports; p++) {

			port = node->ports[p];
			if (!port || !port->remoteport)
				continue;

			if ((is_4700_line && (port->portnum > 18)) ||
			    (!is_4700_line && (port->portnum > 12)))
				continue;

			remnode = port->remoteport->node;

			if (!remnode->ch_found)
				continue;	/* some error - spine not initialized ? FIXME */
			if (insert_spine(remnode, chassis))
				return -1;
		}
	}
	return 0;
}
示例#17
0
文件: chassis.c 项目: Cai900205/test
int is_chassis_switch(ibnd_node_t * n)
{
	return (is_spine(n) || is_line(n));
}
示例#18
0
int main(int argc, char* argv[])
{
    // Check if WiringPi is properly installed.
    if (wiringPiSetup () == -1) {
      std::cout << "Please install WiringPi first (http://wiringpi.com/download-and-install/)." << '\n';
      return 1;
    }

    // Check if an argument is present.
    if (argc < 2) {
      std::cout << "Please enter at least one argument: ./Ring white" << '\n' << "You can also use multiple arguments: ./Ring black white black." << '\n';
      return 1;
    }


    // Read config file.
    std::string line;
    std::ifstream configFile("config.ini");
    if (configFile)
    {
        std::cout << "Config file found." << '\n';
    }
    else
    {
        std::cout << "No config file found, using default settings." << '\n';
    }
    while (std::getline(configFile, line))
    {
        std::istringstream is_line(line);
        std::string key;
        if (std::getline(is_line, key, '='))
        {
            std::string value;
            // Skip comment lines.
            if (key[0] == '#')
                continue;

            // Handle settings.
            if (std::getline(is_line, value))
            {
                std::cout << "Read config key '" << key << "' value '" << value << "'" << '\n';
                if (strcmp(key.c_str(), "gpio") == 0)
                {
                    rfPin = strtoul(value.c_str(), 0, 10);
                }
                else if (strcmp(key.c_str(), "timing") == 0)
                {
                    timing = strtoul(value.c_str(), 0, 10);
                }
                else if (strcmp(key.c_str(), "black") == 0)
                {
                    black = strtoul(value.c_str(), 0, 16);
                }
                else if (strcmp(key.c_str(), "white") == 0)
                {
                    white = strtoul(value.c_str(), 0, 16);
                }
                else
                {
                    std::cout << "Unknown config key '" << key << "' value '" << value << "'" << '\n';
                }
            }
        }
    }

    // Loop through arguments.
    for (int count=1; count < argc; ++count) {
        if (!strcmp(argv[count], "white")) {
            SelectPlus(white); // White
            std::cout << count << " Ding Dong (White)" << '\n';
        } else {
            SelectPlus(black); // Black
            std::cout << count << " Ding Dong (Black)" << '\n';
        }
        if (count + 1 < argc) {
            std::cout << count << " Pause (waiting 5s)" << '\n';
            usleep(timing);
        }
    }
}
示例#19
0
文件: chassis.c 项目: Cai900205/test
/*
	This function called for every Voltaire node in fabric
	It could be optimized so, but time overhead is very small
	and its only diag.util
*/
static int fill_voltaire_chassis_record(ibnd_node_t * node)
{
	int p = 0;
	ibnd_port_t *port;
	ibnd_node_t *remnode = 0;

	if (node->ch_found)	/* somehow this node has already been passed */
		return 0;
	node->ch_found = 1;

	/* node is router only in case of using unique lid */
	/* (which is lid of chassis router port) */
	/* in such case node->ports is actually a requested port... */
	if (is_router(node))
		/* find the remote node */
		for (p = 1; p <= node->numports; p++) {
			port = node->ports[p];
			if (port && is_spine(port->remoteport->node))
				get_router_slot(node, port->remoteport);
		}
	else if (is_spine(node)) {
		int is_4700x2 = is_spine_4700x2(node);

		for (p = 1; p <= node->numports; p++) {
			port = node->ports[p];
			if (!port || !port->remoteport)
				continue;

			/*
			 * Skip ISR4700 double density fabric boards ports 19-36
			 * as they are chassis external ports
			 */
			if (is_4700x2 && (port->portnum > 18))
				continue;

			remnode = port->remoteport->node;
			if (remnode->type != IB_NODE_SWITCH) {
				if (!remnode->ch_found)
					get_router_slot(remnode, port);
				continue;
			}
			if (!node->ch_type)
				/* we assume here that remoteport belongs to line */
				get_sfb_slot(node, port->remoteport);

			/* we could break here, but need to find if more routers connected */
		}

	} else if (is_line(node)) {
		int is_4700_line = is_line_4700(node);

		for (p = 1; p <= node->numports; p++) {
			port = node->ports[p];
			if (!port || !port->remoteport)
				continue;

			if ((is_4700_line && (port->portnum > 18)) ||
			    (!is_4700_line && (port->portnum > 12)))
				continue;

			/* we assume here that remoteport belongs to spine */
			get_slb_slot(node, port->remoteport);
			break;
		}
	}

	/* for each port of this node, map external ports */
	for (p = 1; p <= node->numports; p++) {
		port = node->ports[p];
		if (!port)
			continue;
		voltaire_portmap(port);
	}

	return 0;
}
示例#20
0
int is_chassis_switch(Node *node)
{
    return (is_spine(node) || is_line(node));
}
示例#21
0
//merging of 2 convex hulls
std::vector<Point2D> merge(std::vector<Point2D> set1, std::vector<Point2D> set2)
{

    Point2Df p;
    std::vector<Point2D> sum;
    int is_line1 = is_line(set1);
    int is_line2 = is_line(set2);

    if(!is_line1)
    {
        for(int i = 0; i < set1.size() - 2; i++)
        {
            if(is_left(set1[i], set1[i + 1], set1[i + 2]) != 0)
            {
                p = centroid(set1[i], set1[i + 1], set1[i + 2]);
                break;
            }
        }
    }
    else if(!is_line2)
    {
        for(int i = 0; i < set2.size() - 2; i++)
        {
            if(is_left(set2[i], set2[i + 1], set2[i + 2]) != 0)
            {
                p = centroid(set2[i], set2[i + 1], set2[i + 2]);
                break;
            }
        }
    }

    if(!is_line1 && !is_line2)// 2 polygons
    {
        if(in_polygon(set2, p) != 0)
        {
            sum = merge_polygons(set1, set2, p);
            return graham_scan(sum);

        }
        else
        {
            std::vector<Point2D> clean_set2;

            clean_set2 = delete_chain(set2, p);
            sum = merge_polygons(set1, clean_set2, p);

            return graham_scan(sum);
        }
    }
    else if (!is_line1 && is_line2)//polygon with centroid p and line
    {

        std::vector<Point2D> clean_set2;
       /*
        clean_set2 = delete_chain(set2, p);
        sum = merge_polygons(set1, clean_set2, p);
        */


        if(angle_compare(p, (Point2Df)set2[0], (Point2Df)set2[set2.size() - 1]))
        {
            clean_set2.push_back(set2[0]);
            clean_set2.push_back(set2[set2.size() - 1]);
        }
        else
        {
            clean_set2.push_back(set2[set2.size() - 1]);
            clean_set2.push_back(set2[0]);
        }

        sum = merge_polygons(set1, clean_set2, p);

        return graham_scan(sum);
    }
    else if(is_line1 && !is_line2)
    {
        std::vector<Point2D> clean_set1;
    /*
        clean_set1 = delete_chain(set1, p);
        sum = merge_polygons(clean_set1, set2, p);
    */
        if(angle_compare(p, (Point2Df)set1[0], (Point2Df)set1[set1.size() - 1]))
        {
            clean_set1.push_back(set1[0]);
            clean_set1.push_back(set1[set1.size() - 1]);
        }
        else
        {
            clean_set1.push_back(set1[set1.size() - 1]);
            clean_set1.push_back(set1[0]);
        }

        sum = merge_polygons(clean_set1, set2, p);
        return graham_scan(sum);

    }
    else // if(is_line1 && is_line2)
    {
        std::vector<Point2D> clean_set1;
        clean_set1.push_back(set1[0]);
        clean_set1.push_back(set1[set1.size() - 1]);
        clean_set1.push_back(set2[0]);
        clean_set1.push_back(set2[set2.size() - 1]);
        return get_hull(clean_set1);
    }
}