Just use forwarding:

        struct ROI;   // don't include the full definition here

        class ImageSpec {
            ...
            ImageSpec (const ROI &roi);   // don't include the implementation 
here
            ...
        };

But I'm not convinced you need an ImageSpec constructor for this, or that ROI 
needs to make its way all the way to imageio.h.  ImageSpec is just a simple 
struct, really.  Why not just make a utility function local to where you define 
and use ROI (imagebuf.h? imagebufalgo.h?) that modifies an ImageSpec to set its 
bounds to that of a ROI?  We don't provide ImageSpec constructors that let you 
set every possible field; the code just does that "by hand" when necessary.



On Jun 19, 2012, at 6:07 AM, Stefan Stavrev wrote:

> I need a constructor ImageSpec(const ROI &roi, int nchans, int alpha_chan). 
> The problem is, ImageSpec class is in imageio.h and ROI class is in 
> imagebuf.h, and imageio.h includes imagebuf.h. So, ROI is not visible in 
> imageio.h and you can't include imagebuf.h in imageio.h, because of cyclic 
> dependency.
> 
> Why not create a separate header for ImageSpec? There is already a separate 
> .cpp called formatspec.cpp.
> 
> If we can't do that, how should I handle this constructor? I could  provide 6 
> parameters xbegin, xend, ... instead of ROI but that would be ugly.
> 

--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to