hmmm, not too sure what's wrong. was able to get the code to compile no
problems on fedora 8 linux 64 under both nuke 6.3v5 and 6.3v6

i've attached the modified code and makefile. hope that works for you.

josh

On Wed, May 9, 2012 at 11:06 AM, cluedo <nuke-dev-re...@thefoundry.co.uk>wrote:

> **
> Ok, here's the cut-down code:
>
> *Code:*  #include "DDImage/Iop.h"
> #include "DDImage/Row.h"
> #include "DDImage/Pixel.h"
> #include "DDImage/Interest.h"
> #include "DDImage/Knobs.h"
> #include **
> #include "DDImage/Memory.h"
> #include **
> #include "DDImage/Thread.h"
> #include **
> #include "DDImage/ImageCache.h"
>
> #include "DDImage/DDImage_API.h"
>
> using namespace DD::Image;
>
> static const char* const CLASS = "TestCache";
> static const char* const HELP = "...";
>
>
> class TestCache : public Iop
> {
>
> private:
>    void _validate(bool);
>    virtual void _request(int, int, int, int, ChannelMask, int);
>    virtual void engine(int y, int x, int r, ChannelMask, Row & t);
>    virtual void _close();
>
>    Lock _lock;
>    bool _firstTime;
>    float _param1;
>
> public:
>    TestCache(Node* node);
>    virtual void knobs(Knob_Callback);
>    virtual int  knob_changed(Knob*);
>    const char* Class() const { return CLASS; }
>    const char* node_help() const { return HELP; }
>    static const Iop::Description d;
> };
>
>
> TestCache::TestCache(Node* node) : Iop(node)
> {
>    inputs();
> }
>
> void TestCache::_validate(bool)
> {
>    copy_info();
>    _firstTime = true;
> }
>
> void TestCache::_request(int x, int y, int r, int t, ChannelMask channels,
> int count)
> {
>    _firstTime = true;
>
>    //set up the channels
>    input(0)->request(x, y, r, t, channels, count);
>
> }
>
> void TestCache::engine(int y, int x, int r, ChannelMask channels, Row& row)
> {
>    Guard guard(_lock);
>    if ( _firstTime )
>    {
>
>       Image_Cache *iCache = &Image_Cache::mainCache();
>       std::cout << "Checking active cache: " <**is_active() << "\n";
>       //create the hash object...
>       DD::Image::Hash hash;
>       hash.reset();
>       hash.append(_param1);
>
>       //... then check to see if it is in the cache
>       if (iCache->is_active() && iCache->has_file(hash))
>       {
>
>          DD::Image::ImageCacheReadI* cacheRead = iCache->open(hash);
>       }
>    }  //end lock
>
>    //Output the pixels without any changes
>    foreach(z, channels)
>    {
>       float* outptr = row.writable(z) + x;
>       for(int i = x; i **at(i, y, original_pixel);
>          *outptr++ = original_pixel[z];
>       }
>    }
>
> }
>
> void TestCache::_close()
> {
>      //delete any global objects created during the algorithm
>    //deleteObjects();
> }
>
>
> void TestCache::knobs(Knob_Callback f)
> {
>    Float_knob(f, &_param1, "Param 1: ");
>    Tooltip(f, "Parameter 1");
> }
>
> int TestCache::knob_changed(Knob* k)
> {
>    _firstTime = true;
>    return 1; //Iop::knob_changed(k);
> }
>
> static Iop* CreateTestCacheNode(Node* node) { return new TestCache(node); }
>
> const Iop::Description TestCache::d(CLASS, "TestCache",
> CreateTestCacheNode);
>
> And here's the output:
> ../TestCache.cpp: In member function 'virtual void TestCache::engine(int,
> int, int, const DD::Image::ChannelSet&, DD::Image::Row&)':
> ../TestCache.cpp:81: error: 'ImageCacheReadI' is not a member of
> 'DD::Image'
> ../TestCache.cpp:81: error: 'cacheRead' was not declared in this scope
>
> Do you get this same error on your machine? Or perhaps it is something to
> do with my setup...?
>
> Thanks very much.
>
> _______________________________________________
> Nuke-dev mailing list
> Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
>

Attachment: Makefile
Description: Binary data

#include "DDImage/Iop.h"
#include "DDImage/Row.h"
#include "DDImage/Pixel.h"
#include "DDImage/Interest.h"
#include "DDImage/Knobs.h"
#include "DDImage/Memory.h"
#include "DDImage/Thread.h"
#include "DDImage/ImageCache.h"

#include "DDImage/DDImage_API.h"

using namespace DD::Image;

static const char* const CLASS = "TestCache";
static const char* const HELP = "...";


class TestCache : public Iop
{

    private:
        void _validate(bool);
        virtual void _request(int, int, int, int, ChannelMask, int);
        virtual void engine(int y, int x, int r, ChannelMask, Row & t);
        virtual void _close();

        Lock _lock;
        bool _firstTime;
        float _param1;

    public:
        TestCache(Node* node);
        virtual void knobs(Knob_Callback);
        virtual int  knob_changed(Knob*);
        const char* Class() const { return CLASS; }
        const char* node_help() const { return HELP; }
        static const Iop::Description d;
};


TestCache::TestCache(Node* node) : Iop(node)
{
    inputs();
}

void TestCache::_validate(bool)
{
    copy_info();
    _firstTime = true;
}

void TestCache::_request(int x, int y, int r, int t, ChannelMask channels, int count)
{
    _firstTime = true;

   //set up the channels
    input(0)->request(x, y, r, t, channels, count);

}

void TestCache::engine(int y, int x, int r, ChannelMask channels, Row& row)
{
    Guard guard(_lock);
    if ( _firstTime )
    {

        Image_Cache *iCache = &Image_Cache::mainCache();
        std::cout << "Checking active cache: " << iCache->is_active() << "\n";
      //create the hash object...
        DD::Image::Hash hash;
        hash.reset();
        hash.append(_param1);

      //... then check to see if it is in the cache
        if (iCache->is_active() && iCache->has_file(hash))
        {

            DD::Image::ImageCacheReadI* cacheRead = iCache->open(hash);
            cacheRead->close();
        }
    }  //end lock
   
    Row in_row(x,r);
    input0().get(y, x, r, channels, in_row);
    Format input_format = input0().full_size_format();

   //Output the pixels without any changes
    foreach(z, channels)
    {
        float* outptr = row.writable(z) + x;
        for(int i = x; i < r; ++i) {
            *outptr++ = in_row[z][i];
        }
    }

}

void TestCache::_close()
{
     //delete any global objects created during the algorithm
   //deleteObjects();
}


void TestCache::knobs(Knob_Callback f)
{
    Float_knob(f, &_param1, "Param 1: ");
    Tooltip(f, "Parameter 1");
}

int TestCache::knob_changed(Knob* k)
{
    _firstTime = true;
    return 1; //Iop::knob_changed(k);
}

static Iop* CreateTestCacheNode(Node* node) { return new TestCache(node); }

const Iop::Description TestCache::d(CLASS, "TestCache", CreateTestCacheNode); 
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to