Skip to content
Permalink
Browse files

removing smart pointers

  • Loading branch information...
xoltar committed Nov 27, 2017
1 parent 5c6ccfe commit e47e97ce09a7a74856f4c413ca246adb94a22d43
@@ -327,27 +327,27 @@ int main(int argc, char* argv[])
//of the run. This message just announces the absolute path of the file.
//The viewer should capture the file name from the stdout stream, and
//then wait for the console program to finish before attempting to read the file.
// std::stringstream ss(std::ios_base::binary | std::ios_base::out | std::ios_base::in);
// {
// boost::archive::binary_oarchive archive(ss);
// archive << *arrangement_message;
// }
// std::clog << "Testing deserialization locally..." << std::endl;
// std::string original = ss.str();
// ArrangementMessage test;
// {
// boost::archive::binary_iarchive inarch(ss);
// inarch >> test;
// std::clog << "Deserialized!";
// }
// if (!(*arrangement_message == test)) {
// throw std::runtime_error("Original and deserialized don't match!");
// }
// Arrangement reconstituted = arrangement_message->to_arrangement();
// ArrangementMessage round_trip(reconstituted);
// if (!(round_trip == *arrangement_message)) {
// throw std::runtime_error("Original and reconstituted don't match!");
// }
std::stringstream ss(std::ios_base::binary | std::ios_base::out | std::ios_base::in);
{
boost::archive::binary_oarchive archive(ss);
archive << *arrangement_message;
}
std::clog << "Testing deserialization locally..." << std::endl;
std::string original = ss.str();
ArrangementMessage test;
{
boost::archive::binary_iarchive inarch(ss);
inarch >> test;
std::clog << "Deserialized!";
}
if (!(*arrangement_message == test)) {
throw std::runtime_error("Original and deserialized don't match!");
}
Arrangement reconstituted = arrangement_message->to_arrangement();
ArrangementMessage round_trip(reconstituted);
if (!(round_trip == *arrangement_message)) {
throw std::runtime_error("Original and reconstituted don't match!");
}
if (binary) {
std::cout << "ARRANGEMENT: " << params.outputFile << std::endl;
} else if (verbosity > 0) {
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "math/template_points_matrix.h"
#include <ostream>

Anchor::Anchor(std::shared_ptr<TemplatePointsMatrixEntry> e)
Anchor::Anchor(TemplatePointsMatrixEntry* e)
: x_coord(e->x)
, y_coord(e->y)
, entry(e)
@@ -77,12 +77,12 @@ unsigned Anchor::get_y() const
return y_coord;
}

void Anchor::set_line(std::shared_ptr<Halfedge> e)
void Anchor::set_line(Halfedge* e)
{
dual_line = e;
}

std::shared_ptr<Halfedge> Anchor::get_line() const
Halfedge* Anchor::get_line() const
{
return dual_line;
}
@@ -107,7 +107,7 @@ void Anchor::toggle()
above_line = !above_line;
}

std::shared_ptr<TemplatePointsMatrixEntry> Anchor::get_entry()
TemplatePointsMatrixEntry* Anchor::get_entry()
{
return entry;
}
@@ -35,7 +35,7 @@ struct TemplatePointsMatrixEntry;

class Anchor {
public:
Anchor(std::shared_ptr<TemplatePointsMatrixEntry> e); //default constructor
Anchor(TemplatePointsMatrixEntry* e); //default constructor
Anchor(unsigned x, unsigned y); //constructor, requires only x- and y-coordinates
Anchor(); //For serialization

@@ -46,16 +46,16 @@ class Anchor {
unsigned get_x() const; //get the discrete x-coordinate
unsigned get_y() const; //get the discrete y-coordinate

void set_line(std::shared_ptr<Halfedge> e); //set the pointer to the line corresponding to this Anchor in the arrangement
std::shared_ptr<Halfedge> get_line() const; //get the pointer to the line corresponding to this Anchor in the arrangement
void set_line(Halfedge* e); //set the pointer to the line corresponding to this Anchor in the arrangement
Halfedge* get_line() const; //get the pointer to the line corresponding to this Anchor in the arrangement

void set_position(unsigned p); //sets the relative position of the Anchor line at the sweep line, used for Bentley-Ottmann DCEL construction algorithm
unsigned get_position() const; //gets the relative position of the Anchor line at the sweep line, used for Bentley-Ottmann DCEL construction algorithm

bool is_above(); //returns true iff this Anchor is above the current slice line, used for the vineyard-update process of storing persistence data in cells of the arrangement
void toggle(); //toggles above/below state of this Anchor; called whever the slice line crosses this Anchor in the vineyard-update process of storing persistence data

std::shared_ptr<TemplatePointsMatrixEntry> get_entry(); //accessor
TemplatePointsMatrixEntry* get_entry(); //accessor

void set_weight(unsigned long w); //sets the estimate of the cost of updating the RU-decomposition when crossing this anchor
unsigned long get_weight(); //returns estimate of the cost of updating the RU-decomposition when crossing this anchor
@@ -67,9 +67,9 @@ class Anchor {
unsigned x_coord; //discrete x-coordinate
unsigned y_coord; //discrete y-coordinate

std::shared_ptr<TemplatePointsMatrixEntry> entry; //TemplatePointsMatrixEntry at the position of this anchor
TemplatePointsMatrixEntry* entry; //TemplatePointsMatrixEntry at the position of this anchor

std::shared_ptr<Halfedge> dual_line; //pointer to left-most halfedge corresponding to this Anchor in the arrangement
Halfedge* dual_line; //pointer to left-most halfedge corresponding to this Anchor in the arrangement
unsigned position; //relative position of Anchor line at sweep line, used for Bentley-Ottmann DCEL construction algorithm
bool above_line; //true iff this Anchor is above the current slice line, used for the vineyard-update process of storing persistence data in cells of the arrangement
unsigned long weight; //estimate of the cost of updating the RU-decomposition when crossing this anchor

0 comments on commit e47e97c

Please sign in to comment.
You can’t perform that action at this time.