Static problem

Bob Cowdery bob at bobcowdery.plus.com
Thu Oct 7 12:22:06 PDT 2010


 Can someone sort out what I'm doing wrong here please.
-------------
import std.concurrency, std.stdio;
import Definitions.procNames;

class CRegistry {
    static Tid[E_PROC] TidRegistry;

    static void register(E_PROC name, Tid tid) {

        writeln(TidRegistry);
        TidRegistry[name] = tid;
    }

    static Tid getTid(E_PROC name) {

        //writeln("Entries: ", TidRegistry);
        if(name in TidRegistry) {
            writeln ("Returning ,", TidRegistry[name], " for " , name);
            return TidRegistry[name];
        }
        return thisTid();
    }
}
--------------

I register TID's like so:
CRegistry.register(E_PROC.HPSDR, hpsdr_tid);
and get them like so:
CRegistry.getTid(E_PROC.HPSDR);

If I call getTid() from any another module other than the one than set
the values, TidRegistry is empty. How do I share this registry between
modules.

Thanks
bob




More information about the Digitalmars-d-learn mailing list