lost among the pointers and structs

I have a header file that I cant figure out. Ill try to keep my question simple even though I want to ask about a hundred different questions.

How do I pass the interrupt pins that im using to the Encoder class but then read the 'state' varriable in the Encoder_internal_state_t struct?

Within my void Loop I want to read Encoder_internal_state_t.state as my encoder moves.

This is a small excerpt of the code I think is relevant, but I attached the full header file for anyone that needs it.

typedef struct {
	volatile IO_REG_TYPE * pin1_register;
	volatile IO_REG_TYPE * pin2_register;
	IO_REG_TYPE            pin1_bitmask;
	IO_REG_TYPE            pin2_bitmask;
	uint8_t                state;
	int32_t                position;
} Encoder_internal_state_t;

class Encoder
{
public:
	Encoder(uint8_t pin1, uint8_t pin2) {
		#ifdef INPUT_PULLUP
		pinMode(pin1, INPUT_PULLUP);
		pinMode(pin2, INPUT_PULLUP);
		#else
		pinMode(pin1, INPUT);
		digitalWrite(pin1, HIGH);
		pinMode(pin2, INPUT);
		digitalWrite(pin2, HIGH);
		#endif
		encoder.pin1_register = PIN_TO_BASEREG(pin1);
		encoder.pin1_bitmask = PIN_TO_BITMASK(pin1);
		encoder.pin2_register = PIN_TO_BASEREG(pin2);
		encoder.pin2_bitmask = PIN_TO_BITMASK(pin2);
		encoder.position = 0;
		// allow time for a passive R-C filter to charge
		// through the pullup resistors, before reading
		// the initial state
		delayMicroseconds(2000);
		uint8_t s = 0;
		if (DIRECT_PIN_READ(encoder.pin1_register, encoder.pin1_bitmask)) s |= 1;
		if (DIRECT_PIN_READ(encoder.pin2_register, encoder.pin2_bitmask)) s |= 2;
		encoder.state = s;

Encoder.h (25.1 KB)

If it is an "internal" struct, it is probably intended that you don't access it directly, you should probably use
public functions of the class to get the data you want.

However one of the advantages of having your own microcontroller, is that you can ignore some of this
class encapsulation correctness b/s.

How do I pass the interrupt pins that im using to the Encoder class

They are the arguments to the constructor.

but then read the 'state' varriable in the Encoder_internal_state_t struct?

You don't. You should only use the read() method to get the position.

Why do you think you need the state?