I am still on my adventure to implement a library for manipulating bits for device drivers. I want to be able to define a struct or a class that has the same layout as the hardware registers and also define bits for the registers. I want to have compile time checking to make sure that I use the bit definitions with the proper register. Underneath will be something maybe called "access" classes that would pull the data from the hardware device on the bus or write it back out. Sometimes that is just a simple pointer dereference but other times it is a kernel service call. I've worked on this for a couple of weeks (off and on) and I have something that is kinda working but does not do everything that I need. All that to lead up to this question: from what I've determined so far, all this boils down to giving what is equivalent to traits to members of a class or struct. Then I can give traits to the bit fields and have a compile time assert to make sure that the traits match. My only thought so far is to give each member its own unique type and then assign traits to those types. I am wondering if that seems like a viable path or if there are alternate (better?) ways. Thank you, Perry
participants (1)
-
Perry Smith