Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Okay thanks again, and one more question if you dont mind, are vectors allowed to be used in a sc_module as a data structure?
  2. Thank you for the reply, so in order for me to pass an Image over sc_fifo, would I have to change my Image class code to something like this? template <typename T> class Image; template <typename T> ostream& operator<<(ostream &, const Image<T> &); template<typename T> class Image { public: friend ostream& operator<< <>(ostream & output, const Image<T> & theImage); ... }; template<typename T> ostream& operator<<(ostream & output, const Image<T> & theImage) { ... return output; } Can you show an example of how I would use the assignment operator and would I have to change the Image.cpp file to accommodate this change? Image.cpp ________________________________________________________________________________________________________________________________________________________________________________________ #include "Image.h" //void Image::setImage(int imageNumber, Objects objects[]) //{ // this->imageNumber = imageNumber; // // int i = 0; // while (i < sizeof(*objects)) // { // this->objects = objects; // i++; // } // //} Image::Image(int imageNumber, std::vector<ImageObjects> obj) { this->imageNumber = imageNumber; this->obj = obj; } ____________________________________________________________________________________________________________________________________________________________________________________________ Thanks again!
  3. Hello, I want to make a server module that outputs a user defined class through sc_fifo and I'm not sure if that is possible. So far, I have this Server module header ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #include <systemc.h> #include "Gaze.h" #include "ImageObjects.h" #include "Image.h" #include "iostream.h" #include "fstream.h" #include "string.h" #include <sstream> SC_MODULE(Server) { //PORTS FOR SERVER sc_in_clk clk; //Clock sc_in<sc_uint<8> > check; //Signal for client to request new image sc_port<sc_fifo_in<Gaze >> inClient; // input from client sc_port<sc_fifo_out<Image >> output; //output to client void sendImage(sc_uint<8> img); //Function to send image to client std::vector<Image> getImages(); //Takes in annotation files and saves them as images //Local data structures std::vector<Image> ImageBuffer; SC_CTOR(Server) { SC_METHOD(sendImage); sensitive << check; } }; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Would "sc_port<sc_fifo_out<Image >> output;" that line of code work? Image is just a class I created in c++ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ #include "ImageObjects.h" #include <vector> class Image : public sc_interface { public: int imageNumber; std::vector<ImageObjects> obj; Image(int i, std::vector<ImageObjects> ob); //void setImage(int, Objects[]); virtual Image returnImage(); }; --------------------------------------------------------------------------------------------------------------------------------------------- Thanks for all the help!