private int getNumEntries(Program program, Address rtti2Address) {

		Memory memory = program.getMemory();
		Address addr = rtti2Address;
		boolean shouldValidateReferredToData = validationOptions.shouldValidateReferredToData();
		int ordinal = 0;
		for (; addr != null && validRefData(memory, addr); ordinal++) {

			// Each component is either a direct reference or an image base offset.
			Address rtti1Address = getReferencedAddress(program, addr);
			if (rtti1Address == null) {
				return ordinal; // It has reached the end.
			}
			Rtti1Model rtti1Model = new Rtti1Model(program, rtti1Address, validationOptions);
			if (shouldValidateReferredToData) {
				try {
					rtti1Model.validate();
				}
				catch (InvalidDataTypeException e1) {
					return ordinal; // It has reached the end.
				}
			}
			else if (!rtti1Model.isLoadedAndInitializedAddress()) {
				return ordinal;
			}

			try {
				addr = addr.add(entrySize); // Add the data type size.
			}
			catch (AddressOutOfBoundsException e) {
				return ordinal + 1; // Ordinal hasn't been incremented yet.
			}
		}

		return ordinal;
	}
This gets the BaseClassArray (RTTI 2) structure for this model.
@return the BaseClassArray (RTTI 2) structure.
Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/rtti/Rtti2Model.java